csShowAllEffect.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class csShowAllEffect : MonoBehaviour
  5. {
  6. public string[] EffectNames;
  7. public string[] Effect2Names;
  8. public Transform[] Effect;
  9. public Text Text1;
  10. int i = 0;
  11. int a = 0;
  12. void Start()
  13. {
  14. Instantiate(Effect[i], new Vector3(0, 5, 0), Quaternion.identity);
  15. }
  16. void Update()
  17. {
  18. Text1.text = i + 1 + ":" + EffectNames[i];
  19. if (Input.GetKeyDown(KeyCode.Z))
  20. {
  21. if (i <= 0)
  22. i = 99;
  23. else
  24. i--;
  25. for (a = 0; a < Effect2Names.Length; a++)
  26. {
  27. if (EffectNames[i] == Effect2Names[a])
  28. {
  29. Instantiate(Effect[i], new Vector3(0, 0.01f, 0), Quaternion.identity);
  30. break;
  31. }
  32. }
  33. if (a++ == Effect2Names.Length)
  34. Instantiate(Effect[i], new Vector3(0, 5, 0), Quaternion.identity);
  35. }
  36. if (Input.GetKeyDown(KeyCode.X))
  37. {
  38. if (i < 99)
  39. i++;
  40. else
  41. i = 0;
  42. for (a = 0; a < Effect2Names.Length; a++)
  43. {
  44. if (EffectNames[i] == Effect2Names[a])
  45. {
  46. Instantiate(Effect[i], new Vector3(0, 0.01f, 0), Quaternion.identity);
  47. break;
  48. }
  49. }
  50. if (a++ == Effect2Names.Length)
  51. Instantiate(Effect[i], new Vector3(0, 5, 0), Quaternion.identity);
  52. }
  53. if (Input.GetKeyDown(KeyCode.C))
  54. {
  55. for (a = 0; a < Effect2Names.Length; a++)
  56. {
  57. if (EffectNames[i] == Effect2Names[a])
  58. {
  59. Instantiate(Effect[i], new Vector3(0, 0.01f, 0), Quaternion.identity);
  60. break;
  61. }
  62. }
  63. if (a++ == Effect2Names.Length)
  64. Instantiate(Effect[i], new Vector3(0, 5, 0), Quaternion.identity);
  65. }
  66. }
  67. }