コード例 #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 (PAI == null)
     {
         PAI = animator.GetComponent <PoacherAI>();
     }
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!damagedTreeFound)
        {
            allTrees = FindObjectsOfType <TreeControl>();
            foreach (TreeControl t in allTrees)
            {
                if (t.IsPlanted && t.CurrentHealth < t.maxHealth)
                {
                    tree             = t;
                    damagedTreeFound = true;
                    StartHealTut();
                    break;
                }
            }
        }

        if (!healFinished && damagedTreeFound)
        {
            if (tree.CurrentHealth == tree.maxHealth)
            {
                healFinished = true;
                FinishHealTut();
            }
        }

        if (!poacherFound)
        {
            GameObject p = GameObject.FindGameObjectWithTag("Poacher");
            if (p != null)
            {
                firstPoacher = p.GetComponent <PoacherAI>();
                poacherFound = true;
            }
        }

        if (!revealStarted && poacherFound)
        {
            if (firstPoacher.IsHiding)
            {
                StartRevealTut();
                revealStarted = true;
            }
        }

        if (!revealFinished && revealStarted)
        {
            if (!firstPoacher.IsHiding)
            {
                FinishRevealTut();
                revealFinished = true;
            }
        }

        if (revealFinished && healFinished)
        {
            DisableAllPlayerTut();
            this.enabled = false;
        }
    }
コード例 #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 (PAI == null)
        {
            PAI = animator.GetComponent <PoacherAI>();
        }

        PAI.Camouflage();
        waitTime = Random.Range(5f, 10f);
    }
コード例 #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 (PAI == null)
        {
            PAI = animator.GetComponent <PoacherAI>();
        }

        PAI.FindHidePosition();
    }
コード例 #5
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 (PAI == null)
        {
            PAI = animator.GetComponent <PoacherAI>();
        }

        //set the navmesh agent target
        currTargetDest = PAI.CurrTargetDest;
        navAgent.SetDestination(currTargetDest);
    }
コード例 #6
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 (PAI == null)
        {
            PAI = animator.GetComponent <PoacherAI>();
        }

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

        navAgent.enabled = true;

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

        navAgent.speed += speedIncrease;

        isDestroyed = false;
        FindFleeDestination(animator);
    }