예제 #1
0
    void Update()
    {
        critter = uiControl.ViewSelectedCritter();

        if(critter){
            critterSprite = critter.GetTokenSprite();
            color = critter.GetTokenColor();
        }

        this.GetComponent<Image>().sprite = critterSprite;
        this.GetComponent<Image>().color = color;
    }
예제 #2
0
    public void Clone(Critter originalCritter, Hex habitat)
    {
        name = "Bob " + num; num++;
        GameObject newCreature = originalCritter.gameObject;
        EvolutionList originList = originalCritter.GetComponent<EvolutionList>();

        GameObject creature = Instantiate(newCreature, newCreature.transform.position, Quaternion.identity) as GameObject;
        critter = creature.GetComponent<Critter>();

        creature.name = name;
        critter.SetName (name);
        critter.SetNumber(critterCount);
        critter.CloneStats(originalCritter);

        baseFoodValue = (size * size) * 10;
        critter.SetBaseFoodValue(baseFoodValue);
        critter.SetTokenSprite(SelectSprite());
        critter.SetTokenColor(originalCritter.GetTokenColor());
        critter.GenerateDiet();
        critter.GenerateLocomotion();
        critter.SetIsPlayer(false);

        critter.ResetAllXP();

        critter.adultPopulations.Clear();
        critter.cubPopulations.Clear();
        critter.babyPopulations.Clear();
        critter.ClearTokenList();
        critter.habitats.Clear();

        CreateCritterLists(critterCount);
        AddToLocalCritterList(critter, habitat);

        critter.adultPopulations.Add(.5f * startPop);
        critter.babyPopulations.Add(.2f * startPop);
        critter.cubPopulations.Add(.1f * startPop);

        critter.GenerateTokens();

        creature.GetComponent<EvolutionList>().ClearChildren();
        originList.AddNewChild(critter, TurnTimer.currentTurn);

        critter.SetSplinterEvoStart();
        critter.InitializePopsList();

        critterCount++;
    }
예제 #3
0
    public void Activate(Critter newCritter)
    {
        gameObject.SetActive(true);

        if (!circle) {
            circle = GetComponentsInChildren<Image>()[0];
            icon = GetComponentsInChildren<Image>()[1];
            popText = GetComponentInChildren<Text>();
            habitat = GetComponentInParent<Hex>();
        }

        critter = newCritter;
        color = critter.GetTokenColor();
        critterSprite = critter.GetTokenSprite();

        UpdateIcon(critter);
    }
예제 #4
0
    void Update()
    {
        if(critter == null){
            critter = player.GetCritter();

            if(critter == null){
                evoPts.text = "10";
                migrationTokens.text = "0";
            }
            else{
                tokenImg.sprite = critter.GetTokenSprite();
                tokenImg.color = critter.GetTokenColor();
            }
        }
        else
        {
            int totalPop;
            int evoTokens = critter.GetEvoPts();
            int migrateTokens = critter.GetMigrationTokens();

            if(evoTokens > 99){
                evoTokens = 99;
            }
            if(migrateTokens > 99){
                migrateTokens = 99;
            }

            evoPts.text = evoTokens.ToString();
            migrationTokens.text = migrateTokens.ToString();

            if (TurnTimer.currentTurn != currentTurn)
            {
                totalPop = (int)critter.GetTotalPopulation();
                population.text = NormalizePopTesxt(totalPop);
                currentTurn = TurnTimer.currentTurn;
            }

            tokenImg.sprite = critter.GetTokenSprite();
            tokenImg.color = critter.GetTokenColor();
        }
    }