Beispiel #1
0
    public void EvolutionCheck(ActivePet pet)
    {
        EvolutionTree tree = evolutionGarden.GetTree(pet.treeName);

        if (tree == null)
        {
            Debug.LogError("Didn't find tree: " + pet.treeName + " of " + pet.species);
        }
        else
        {
            if (tree.IsTimeToEvolve(pet))
            {
                Species evolveTo = tree.GetEvolution(pet);
                //Debug.Log("Evolving to " + evolveTo.name);
                if (evolveTo)
                {
                    Debug.Log("Evolving to " + evolveTo.name);
                    // Animate
                    if (onEvolutionEvent != null)
                    {
                        onEvolutionEvent(FindSheet(pet.species).idle[0], FindSheet(evolveTo.speciesName).idle[0]);
                    }

                    pet.EvolveTo(PetFactory.Evolve(pet, evolveTo));

                    if (onActivePetsChange != null)
                    {
                        onActivePetsChange(this.activePets);
                    }
                }
            }
        }
    }