Exemplo n.º 1
0
    public void Spawn()
    {
        averageColor = textToColors.averageColors;
        SetCreatureName();

        for (int j = 0; j < 2; j++)             //This loop and the Destroy coroutine at the end are a workaround for a bug causing creature statistics not to update when spawned the first time
        {
            GameObject newCreature = CreateCreature();

            for (int i = 0; i < creatureTypes.creatures.Count; i++)
            {
                if (creatureName == creatureTypes.creatures[i].GivenName)
                {
                    CreatureStatsManager creatureStats = newCreature.GetComponent <CreatureStatsManager>();
                    creatureStats.SetStats(creatureTypes.creatures[i]);
                    CreatureConfirmationDialogue(creatureStats);

                    Debug.Log("I'm a " + creatureStats.stats.GivenName + "!");
                    creatureStats.SetName();
                }
            }

            if (j == 0)
            {
                StartCoroutine(DestroyCreature(newCreature));
            }
        }
    }
Exemplo n.º 2
0
    void GiveName(string givenName)
    {
        foreach (GameObject item in playerCreatures.creaturesOwned)
        {
            if (item == creatureStats.gameObject)
            {
                item.GetComponent <CreatureStatsManager>().stats.GivenName = givenName;
            }
        }

        creatureStats.stats.GivenName = givenName;

        creatureStats.SetName();
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(6).GetComponent <Text>().text = "Name: " + creatureStats.stats.GivenName;

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetChild(1).gameObject.SetActive(false);
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetChild(2).gameObject.SetActive(false);
    }