Exemple #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));
            }
        }
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        creature     = new GameObject();
        textToColors = GetComponentInParent <TextToColors>();
        averageColor = new TextToColors.ColorAverages();

        player      = GameObject.FindGameObjectWithTag("Player");
        dialogueBox = player.GetComponentInChildren <DialogueBox>();

        creatureTypes = GetComponentInParent <CreatureList>();

        //creatureName = "Ratcher";
    }