Пример #1
0
    public void Updatea()
    {
        //decision tree later for different combination of senses being true
        lr.enabled = false;
        if (isDead)
        {
            if (!fixedDeadCollider)
            {
                transform.gameObject.layer = LayerMask.NameToLayer("Obstacles");                 //now an obstacle;
                BoxCollider bc = GetComponent <BoxCollider>();
                bc.center         = new Vector3(transform.position.x, -0.5f, transform.position.z);
                fixedDeadCollider = true;
            }
            return;
        }
        //and if the character is facing the character
        if (isShooting && !gunShot.isPlaying && !gc.isDead)
        {
            shoot();
        }
        if (!(seesPlayer || seesDeadPeople || hearsSomething))
        {
//			Debug.Log ("Wander");
//			wander.Updatea();
//			velocity = wander.velocity;
            if (disturbed)
            {
                wander.Updatea();
                velocity = wander.velocity;
            }
            else
            {
                doDefaultBehaviour();
            }
        }
        else
        {
            Debug.Log("Update GoalPos to: " + reachGoal.goalPos);
            reachGoal.goalPos = poi;
            velocity          = reachGoal.velocity;
        }
        //reaching goal is done with pathfinding which is handled by the pathfinder schedule and the masterscheduler

        doAnimation();
    }