Example #1
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++;
    }
Example #2
0
    //Runs Generators to create values for each species.
    public void Generate(Hex hex, bool isPlayer)
    {
        name = "Bob " + num; num++;
        GenerateSize();

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

        //Assigns generated values for each Species after being Instantiated.
        creature.name = name;
        critter.SetName (name);
        critter.SetNumber(critterCount);

        critter.SetIsPlayer(isPlayer);
        critter.SetSize(size);
        baseFoodValue = (size*size) * 10;
        critter.SetBaseFoodValue(baseFoodValue);
        critter.SetSpeed(StatGenerator());
        critter.SetSneak(StatGenerator());
        critter.SetSense(StatGenerator());
        critter.SetOffense(StatGenerator());
        critter.SetDefense(StatGenerator());
        critter.ModifyEvoPts(startEvoPts);

        critter.adultPopulations.Add(startPop);
        critter.cubPopulations.Add(startPop * .25f);
        critter.babyPopulations.Add(startPop * .25f);
        CreateCritterLists(critterCount);
        AddToLocalCritterList(critter, hex);
        critter.InitializeSlots();
        critter.ResetPreferences();
        UnlockCritterStartEvos(critter);

        if (isPlayer){
            Player player = FindObjectOfType<Player>();

            critter.SetName(player.GetCritterName());
            critter.SetTokenSprite(player.GetCritterTokenSprite());
            critter.SetTokenColor(player.GetCritterTokenColor());
            player.SetCritter(critter);
            hex.SetPlayerHab(true);

        }else if(!isPlayer){
            critter.SetTokenSprite(SelectSprite());
            critter.SetTokenColor(GenerateColor());
            critter.GenerateTokens();
        }
        critter.InitializePopsList();

        critterCount++;
    }