TetsFx.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TetsFx : MonoBehaviour
  5. {
  6. public MyWFX MyWfx;
  7. Vector3 lastPos;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. if (Input.GetKeyDown(KeyCode.A))
  16. {
  17. Vector3 d = transform.position - lastPos;
  18. if (d.sqrMagnitude > 1)
  19. {
  20. int x = (int)transform.position.x/10;
  21. int y = (int)transform.position.z/10;
  22. WFXMapInfo[,] newWfxMap = new WFXMapInfo[6, 10];
  23. List<WFXMapInfo> huiTuiMap = new List<WFXMapInfo>();
  24. // WFXMapInfo[,] WfxMapInfos = MyWfx.WfxMapInfos;
  25. for (int i = 0; i < 6; i++)
  26. {
  27. for (int j = 0; j < 10; j++)
  28. {
  29. int newX = x + i - 2;
  30. int newY = y + j - 3;
  31. int n = newX * 10000 + newY;
  32. WFXMapInfo newName = null;
  33. WFXMapInfo wfxMapInfo = new WFXMapInfo();
  34. if (MyWfx.currAllMapName.TryGetValue(n, out newName))
  35. {
  36. newWfxMap[i, j] = newName;
  37. newName.x = i;
  38. newName.y = j;
  39. huiTuiMap.Add(newName);
  40. }
  41. else
  42. {
  43. wfxMapInfo.x = i;
  44. wfxMapInfo.y = j;
  45. wfxMapInfo.px = newX;
  46. wfxMapInfo.py = newY;
  47. newWfxMap[i, j] = wfxMapInfo;
  48. }
  49. // WfxMapInfos[n, y - MyWfx.lasetStartY];
  50. }
  51. }
  52. MyWfx.NewShengCheng(newWfxMap, huiTuiMap,6,10);
  53. }
  54. }
  55. }
  56. }