WolfActGridCell.cs 715 B

1234567891011121314151617181920212223242526
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class WolfActGridCell : MonoBehaviour
  5. {
  6. public Vector3 pos;
  7. void OnDestroy()
  8. {
  9. if (!WolfActGrid.ins) return;
  10. List<List<Vector3>> matrix = WolfActGrid.ins.areaMatrix.posMatrix;
  11. for (int r = matrix.Count - 1; r >=0 ; r--)
  12. {
  13. List<Vector3> row = matrix[r];
  14. for (int c = row.Count - 1; c >=0 ; c--)
  15. {
  16. Vector3 p = row[c];
  17. if (p.Equals(pos)) {
  18. row.RemoveAt(c);
  19. Debug.LogWarning($"网格单元{gameObject.name}移除成功");
  20. }
  21. }
  22. }
  23. }
  24. }