Beispiel #1
0
    void CreatureAssignmentMenu()
    {
        transform.GetChild(0).GetChild(0).GetChild(2).gameObject.SetActive(true);

        if (!creatureMenuPopulated)
        {
            creatureAssignmentMenuPopulater.numberToCreate = creatureInstanceManager.playerCreatures.creaturesOwned.Count;

            for (int i = 0; i < creatureInstanceManager.playerCreatures.creaturesOwned.Count; i++)
            {
                GameObject           item      = creatureInstanceManager.playerCreatures.creaturesOwned[i];
                CreatureStatsManager itemStats = item.GetComponent <CreatureStatsManager>();

                creatureSprites.Add(item.GetComponent <SpriteRenderer>().sprite);
                creatureDescriptions.Add(itemStats.stats.GivenName + "\n" +
                                         "ST: " + itemStats.stats.stats.strength + "     DX: " + itemStats.stats.stats.dexterity + "\n" +
                                         "IQ: " + itemStats.stats.stats.intelligence + "     FT: " + itemStats.stats.stats.fitness + "\n");
            }

            creatureMenuItems = creatureAssignmentMenuPopulater.Populate(creatureSprites, creatureDescriptions, DoNothing);

            AssignValuesToButtons(creatureMenuItems, creatureInstanceManager.playerCreatures.creaturesOwned);

            creatureMenuPopulated = true;
        }
    }
Beispiel #2
0
    void Rename(CreatureStatsManager creature)
    {
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetChild(1).gameObject.SetActive(true);
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetChild(2).gameObject.SetActive(true);

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetChild(2).GetComponent <InputField>().onEndEdit.AddListener(GiveName);
    }
Beispiel #3
0
    void CreatureConfirmationDialogue(CreatureStatsManager creatureStats)
    {
        GameObject[]   npcs = GameObject.FindGameObjectsWithTag("NPC");
        RaycastHit2D[] hits = Physics2D.RaycastAll(new Vector2(npcs[0].transform.position.x, npcs[0].transform.position.y), Vector2.zero, 0);

        foreach (GameObject npc in npcs)
        {
            if (npc.name == "Aine")
            {
                hits = Physics2D.RaycastAll(new Vector2(npc.transform.position.x, npc.transform.position.y), Vector2.zero, 0);
            }
        }

        foreach (var hit in hits)
        {
            Debug.Log(hit.collider.name + " hit");
            if (hit.collider.name == "Aine")
            {
                NPCDialogueManager dialogueManager = hit.collider.gameObject.GetComponent <NPCDialogueManager>();
                List <string>      dialogue        = dialogueManager.Aine_CreatureConfirmation_Default();
                List <string>      dialogueYes     = dialogueManager.Aine_CreatureConfirmation_Default_Yes();
                List <string>      dialogueNo      = dialogueManager.Aine_CreatureConfirmation_Default_No();

                dialogueBox.isTalking       = true;
                dialogueBox.dialogueManager = dialogueManager;
                dialogueBox.gameObject.transform.GetChild(0).gameObject.SetActive(true);
                dialogueBox.InspectNPC(hit, dialogue, dialogueYes, dialogueNo);
            }
        }
    }
Beispiel #4
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));
            }
        }
    }
Beispiel #5
0
    void InspectCreature(RaycastHit2D hit)
    {
        sprite = hit.collider.gameObject.GetComponent <SpriteRenderer>();
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Image>().sprite = sprite.sprite;

        creatureStats      = hit.collider.gameObject.GetComponent <CreatureStatsManager>();
        creatureController = hit.collider.gameObject.GetComponent <CreatureController>();

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(2).GetComponent <Text>().text = "ST: " + creatureStats.stats.stats.strength;
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(3).GetComponent <Text>().text = "DX: " + creatureStats.stats.stats.dexterity;
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(4).GetComponent <Text>().text = "IQ: " + creatureStats.stats.stats.intelligence;
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(5).GetComponent <Text>().text = "FT: " + creatureStats.stats.stats.fitness;
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(6).GetComponent <Text>().text = "Name: " + creatureStats.stats.GivenName;
        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(7).GetComponent <Text>().text = "Species: " + creatureStats.stats.species;

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(8).GetComponent <Button>().onClick.AddListener(delegate { Rename(creatureStats); });
        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);

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(10).GetComponent <Text>().text = creatureStats.stats.bio;

        this.gameObject.transform.GetChild(0).GetChild(0).GetChild(11).GetComponent <Button>().onClick.AddListener(Leash);
    }