Esempio n. 1
0
    public GameObject ToShoot()
    {
        int               min         = 0;
        AiCube            toShoot     = new AiCube();
        List <GameObject> longestList = new List <GameObject>();

        foreach (AiCube aiCube in FindObjectsOfType <AiCube>())
        {
            List <GameObject> temp = new List <GameObject>();
            temp = aiCube.DFS(temp, aiCube.cubeType);
            if (temp.Count > min)
            {
                toShoot     = aiCube;
                longestList = temp;
                min         = longestList.Count;
            }
        }
        ChangeSpell(toShoot);
        return(toShoot.gameObject);
    }
Esempio n. 2
0
 void ChangeSpell(AiCube aiCube)
 {
     if (aiCube.cubeType == AiCube.AiCubeType.Fire)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(fireSpellPrefab);
         currentSpellType = spellType.FIRE;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
     else if (aiCube.cubeType == AiCube.AiCubeType.Frost)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(frostSpellPrefab);
         currentSpellType = spellType.FROST;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
     else if (aiCube.cubeType == AiCube.AiCubeType.Arcane)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(arcaneSpellPrefab);
         currentSpellType = spellType.ARCANE;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
 }