Exemple #1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        ap    = animator.gameObject.GetComponent <AgentPatrol> ();
        agent = animator.gameObject.GetComponent <PolyNavAgent> ();
        shoot = animator.gameObject.GetComponent <RepeatShoot> ();

        oldMaxSpeed     = agent.maxSpeed;
        oldStoppingDist = agent.stoppingDistance;
        oldSlowingDist  = agent.slowingDistance;
        oldAccelRate    = agent.accelerationRate;
        oldDecelRate    = agent.decelerationRate;

        // SetNewAgent ();

        agent.SetDestination(ap.playerLastPos);

        if (shoot)
        {
            UpdateTargetPos();
            shoot.StopShoot();
        }
        shooting = false;
//		if(shoot){
//			shoot.StartShoot ();
//			shooting = true;
//		}
    }
Exemple #2
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        AgentPatrol ap = animator.GetComponent <AgentPatrol> ();

        if (ap)
        {
            ap.GetClosestNode();
        }
    }
Exemple #3
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        animator.ResetTrigger("reachedDest");

        AgentPatrol ap = animator.GetComponent <AgentPatrol> ();

        if (ap)
        {
            ap.GetClosestNode();
        }
    }
Exemple #4
0
    public override void OnStart()
    {
        //Agent patrol must be controled thhrough here
        if (tank != null)
        {
            a_patrol = tank.GetComponent <AgentPatrol>();
        }

        //a_patrol.Start();
        base.OnStart();
    }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        ap = animator.gameObject.GetComponent <AgentPatrol> ();

        dir2Target = ap.targetNodePos - animator.transform.position;
        dir2Target.Normalize();

        animator.SetFloat("deltaAngle", deltaAngle(dir2Target));

        // rotate towards the target node

//		float rotSpeedRad = rotateSpeed * Mathf.Deg2Rad * Time.deltaTime;
//
//		ap.facing =
//			Vector3.RotateTowards (ap.facing, dir2Target, rotSpeedRad, Mathf.Infinity);
    }
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        ap    = animator.gameObject.GetComponent <AgentPatrol> ();
        agent = animator.gameObject.GetComponent <PolyNavAgent> ();
        shoot = animator.gameObject.GetComponent <RepeatShoot> ();

        if (agent)
        {
            agent.enabled = false;
        }

        if (shoot)
        {
            shoot.StopShoot();
        }
        shooting = false;
    }
    // private GameObject exclamation_UI;
    public override void OnStart()
    {
        if (exclamation_UI != null)
        {
            exclamation_UI.SetActive(true);
        }

        if (tank != null)
        {
            spawner = tank.GetComponentInChildren <SpawnProjectile>();
            seek    = tank.GetComponent <AgentPatrol>();
            // seek.enabled = true;
            //if(spawner.isInSight)
            //    wander.DeleteAgenPath();
            //wander.ChangeTarget();
        }

        base.OnStart();
    }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     ap = animator.gameObject.GetComponent <AgentPatrol> ();
     ap.MoveTowardNode();
 }