Exemple #1
0
    private void createRandomSheepAgent(Vector3 pos)
    {
        GameObject AgentObj  = Instantiate(SheepObj, pos, Quaternion.identity, this.transform);
        SheepAgent tempSheep = AgentObj.GetComponent <SheepAgent>();

        tempSheep.randomAttributeMultis();
        tempSheep.setAtrributes();
        tempSheep.GiveBrain(SheepBrain);
        tempSheep.AgentReset();

        sheeps.Add(tempSheep);
    }
Exemple #2
0
    private void breedSheep(SheepAgent sheepA, SheepAgent sheepB, Vector3 pos)
    {
        //take a random attribute from each parent
        GameObject AgentObj  = Instantiate(SheepObj, pos, Quaternion.identity, this.transform);
        SheepAgent tempSheep = AgentObj.GetComponent <SheepAgent>();

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.healthMulti = sheepA.healthMulti;
        }
        else
        {
            tempSheep.healthMulti = sheepB.healthMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.hungerMulti = sheepA.hungerMulti;
        }
        else
        {
            tempSheep.hungerMulti = sheepB.hungerMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.thirstMulti = sheepA.thirstMulti;
        }
        else
        {
            tempSheep.thirstMulti = sheepB.thirstMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.speedMulti = sheepA.speedMulti;
        }
        else
        {
            tempSheep.speedMulti = sheepB.speedMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.deductMulti = sheepA.deductMulti;
        }
        else
        {
            tempSheep.deductMulti = sheepB.deductMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.absorbMulti = sheepA.absorbMulti;
        }
        else
        {
            tempSheep.absorbMulti = sheepB.absorbMulti;
        }

        if (Random.Range(0.0f, 1.0f) > 0.5)
        {
            tempSheep.interactDisMulti = sheepA.interactDisMulti;
        }
        else
        {
            tempSheep.interactDisMulti = sheepB.interactDisMulti;
        }

        tempSheep.setAtrributes();
        tempSheep.GiveBrain(SheepBrain);

        tempSheep.startPos = pos;

        tempSheep.AgentReset();

        sheeps.Add(tempSheep);
    }