示例#1
0
        void Update()
        {
            if (target == null)
            {
                return;
            }

            if (isHoming && !target.IsDead())
            {
                transform.LookAt(GetAimLocation());
            }

            transform.Translate(Vector3.forward * speed * Time.deltaTime);
        }
示例#2
0
        public bool CanAttack(GameObject combatTarget)
        {
            if (combatTarget == null)
            {
                return(false);
            }
            Health1 targetToTest = combatTarget.GetComponent <Health1>();

            return(targetToTest != null && !targetToTest.IsDead());
        }
示例#3
0
        private void Update()
        {
            if (health.IsDead())
            {
                return;
            }

            if (InAttackRangeOfPlayer() && fighter.CanAttack(player))
            {
                AttackBehaviour();
            }
            else if (timeSinceLastSawPlayer < suspicionTime)
            {
                SuspicionBehaviour();
            }
            else
            {
                PatrolBehaviour();
            }

            UpdateTimers();
        }
示例#4
0
        private void Update()
        {
            timeSinceLastAttack += Time.deltaTime;

            if (target == null)
            {
                return;
            }

            if (target.IsDead())
            {
                return;
            }

            if (!GetIsInRange())
            {
                GetComponent <Mover>().MoveTo(target.transform.position, 1f);
            }
            else
            {
                GetComponent <Mover>().Cancel();
                AttackBehaviour();
            }
        }
示例#5
0
        private void Update()
        {
            if (InteractWithUI())
            {
                return;
            }
            if (health.IsDead())
            {
                SetCursor(CursorType.None);
                return;
            }


            if (InteractWithComponent())
            {
                return;
            }
            if (InteractWithMovement())
            {
                return;
            }

            SetCursor(CursorType.None);
        }
示例#6
0
 void Update()
 {
     navMeshAgent.enabled = !health.IsDead();
     UpdateAnimator();
 }