Esempio n. 1
0
 public void DestroyAllCell()
 {
     if (m_Cells == null || m_Cells.Length <= 0)
     {
         m_W = 0;
         m_H = 0;
         return;
     }
     for (int idx = 0; idx < m_Cells.Length; ++idx)
     {
         FlowFieldCell cell = m_Cells [idx];
         if (cell != null)
         {
                                         #if UNITY_EDITOR
             GameObject.DestroyImmediate(cell.gameObject);
                                         #else
             GameObject.Destroy(cell.gameObject);
                                         #endif
             m_Cells [idx] = null;
         }
     }
     m_Cells = null;
     m_W     = 0;
     m_H     = 0;
 }
Esempio n. 2
0
        public void Awake()
        {
            RaycastHit hit;

            if (Physics.Raycast(this.transform.position + new Vector3(0, 1, 0), new Vector3(0, -1, 0), out hit) && (hit.collider != null) && (hit.collider.gameObject != null))
            {
                var           gameObj = hit.collider.gameObject;
                FlowFieldCell cell    = gameObj.GetComponent <FlowFieldCell>();
                if (cell != null)
                {
                    m_InitCellX = cell.W;
                    m_InitCellY = cell.H;
                    cell.StayActor();
                }
            }
        }