// Use this for initialization
 void Start()
 {
     infected     = false;
     myRenderer   = GetComponent <Renderer>();
     colourBlend  = 0.0f;
     parentScript = GetComponentInParent <CellScript>();
     type         = parentScript.infectedType;
     cellGenes    = parentScript.GetChromosome();
 }
 // Use this for initialization
 void Start()
 {
     infected = false;
     myRenderer = GetComponent<Renderer>();
     colourBlend = 0.0f;
     parentScript = GetComponentInParent<CellScript>();
     type = parentScript.infectedType;
     cellGenes = parentScript.GetChromosome();
 }
Пример #3
0
    private void SetStats()
    {
        health         += myGenes[0] * ScalingHealth;
        damage         += myGenes[1] * ScalingDamage;
        detectionRange += myGenes[2] * ScalingRanged;
        MaxSpeed       += myGenes[3] * ScalingMaxSpeed;
        speed          += myGenes[3] * ScalingAcceleration;

        ModifyScore();

        if (myGenes[0] > geneTriggerValue) // health
        {
            infectedType = InfectedSpecialType.HEALTH;
            if (myGenes[1] > geneTriggerValue) // damage
            {
                infectedType = InfectedSpecialType.MINE;
                return;
            }
            if (myGenes[3] > geneTriggerValue) // speed
            {
                infectedType = InfectedSpecialType.REPLICATION;
                return;
            }
        }
        if (myGenes[1] > geneTriggerValue) // damage
        {
            infectedType = InfectedSpecialType.DAMAGE;
            if (myGenes[3] > geneTriggerValue) // speed
            {
                infectedType = InfectedSpecialType.KAMIKAZE;
                return;
            }
        }
        if (myGenes[3] > geneTriggerValue) // speed
        {
            infectedType = InfectedSpecialType.SPEED;
        }

        if (myGenes[2] > geneTriggerValue)
        {
            ranged       = true;
            infectedType = InfectedSpecialType.RANGED;
        }

        healthChromosome = myGenes[0];
        damageChromosome = myGenes[1];
        rangedChromosome = myGenes[2];
        speedChromosome  = myGenes[3];

        childNucleus.SetChromosome(myGenes);

        SetBlendShapes();
    }
Пример #4
0
    void Awake()
    {
        myGenes        = new Chromosome(4);
        playerDetected = false;
        infected       = false;
        roaming        = true;
        ranged         = false;
        velocity       = new Vector3(0, 0, 0);

        kamikazeTimer = 0.0f;

        animationOffset = Random.Range(0.0f, 10.0f);
        animationSpeed  = Random.Range(0.7f, 1.3f);

        infectedTimerScale = 0.0f;

        rotationAxis = new Vector3(0, 1, 0);

        rotationSpeed = Random.Range(-MaxAngularVelocity, MaxAngularVelocity);

        cellPosition = gameObject.transform;

        gameObject.tag = "Neutral";

        infectedType = InfectedSpecialType.REGULAR;

        skinMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>();

        skinMeshRenderer.SetBlendShapeWeight(0, 100);

        cellStateMachine = new CellFSM();

        cellStateMachine.AddTransition(InfectedCellState.DORMANT, InfectedCellState.CHASINGPLAYER, Chase);
        cellStateMachine.AddTransition(InfectedCellState.CHASINGPLAYER, InfectedCellState.SEARCHING, StartSearching);
        cellStateMachine.AddTransition(InfectedCellState.CHASINGPLAYER, InfectedCellState.CHASINGPLAYER, Chase);
        cellStateMachine.AddTransition(InfectedCellState.SEARCHING, InfectedCellState.CHASINGPLAYER, Chase);
        cellStateMachine.AddTransition(InfectedCellState.DORMANT, InfectedCellState.DORMANT, GoDormant);
        cellStateMachine.AddTransition(InfectedCellState.SEARCHING, InfectedCellState.DORMANT, GoDormant);

        blendShapeChild = GetComponentInChildren <BlendColourScript>();

        childNucleus = GetComponentInChildren <NucleusScript>();
    }