Exemple #1
0
    public void DestroyChunk()
    {
        if (display)
        {
            foreach (MapHoneycomb honeycomb in honeycombs)
            {
                honeycomb.HideHoneycomb();
            }

            for (int i = enemiesInChunk.Count - 1; i >= 0; i -= 1)
            {
                if (enemiesInChunk[i])
                {
                    MapChunk chunk = Utility.GetMapChunk(enemiesInChunk[i].transform.position);
                    if (chunk == this)
                    {
                        enemiesInChunk[i].gameObject.SetActive(false);
                    }
                    else
                    {
                        chunk.AddEnemyToChunk(enemiesInChunk[i]);
                        enemiesInChunk.RemoveAt(i);
                    }
                }
            }
        }
        display = false;
    }
Exemple #2
0
 //public HoneycombCell honeyGrid;
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         Insect   insect = Instantiate(transform.parent.GetComponent <HoneycombCell>().honeyGrid.GetEnemyPrefab(), transform.position, Quaternion.identity).GetComponent <Insect>();
         MapChunk chunk  = Utility.GetMapChunk(insect.transform.position);
         chunk.AddEnemyToChunk(insect);
         insect.InsectPrefab = transform.parent.GetComponent <HoneycombCell>().honeyGrid.GetEnemyPrefab();
         transform.parent.GetComponent <HoneycombCell>().honeyGrid.DestroyHoneycomb();
     }
 }