Exemple #1
0
//State changing away from PURSUE
    void CheckTorch()
    {
        if (currentAgent.isWillInTorchLight() == false)
        {
            protonBeam.fire = false;
            pBeam.SetActive(false);
            currentAgent.anim.SetBool("shoot", false);
            timer = 0;

            //Change colour of torch cone to green
            Color myColor = new Color(0.03f, 0.16f, 0.06f);
            currentAgent.torchCone.GetComponent <Renderer>().material.SetColor("_TintColor", myColor);

            //Will is now out of sight - go to where you last saw Will
            currentAgent.AddPointOfInterest(currentAgent.target.transform.position);

            //Check for points of interest
            if (currentAgent.CheckForPOI() == true)
            {
                currentStateMachine.ChangeState(currentAgent, new GPATROL_Alerted());
            }
            else
            {
                //Default to wander if all else fails
                currentStateMachine.ChangeState(currentAgent, new GPATROL_Wander());
            }

            //More state changing to come
        }
    }