コード例 #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)
    {
        if (fAI == null)
        {
            fAI = animator.GetComponent <FarmerAI>();
        }

        currTarget = fAI.CurrTarget.GetComponent <TreeControl>();
        timer      = 0f;

        currTarget.StartCutting();
        currTarget.CurrentHealth -= 1;  //subtract 1 health immediately after cutting started to avoid delay related situations
    }
コード例 #2
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)
    {
        if (navAgent == null)
        {
            navAgent = animator.GetComponent <NavMeshAgent>();
        }

        if (fAI == null)
        {
            fAI = animator.GetComponent <FarmerAI>();
        }

        navAgent.speed += speedIncrease;

        FindFleeDestination(animator);
    }
コード例 #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)
    {
        if (fAI == null)
        {
            fAI = animator.GetComponent <FarmerAI>();
        }

        if (navAgent == null)
        {
            navAgent = animator.GetComponent <NavMeshAgent>();
        }

        navAgent.enabled = true;

        timer = 0f;
    }
コード例 #4
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)
    {
        if (navAgent == null)
        {
            navAgent = animator.GetComponent <NavMeshAgent>();
        }

        if (fAI == null)
        {
            fAI = animator.GetComponent <FarmerAI>();
        }

        //set the navmesh agent target
        currTarget = fAI.CurrTarget;
        navAgent.SetDestination(currTarget.transform.position);
    }