Example #1
0
        private void Update()
        {
            if (target == null)
            {
                return;
            }

            if (isHoming && target.GetIsAlive())
            {
                transform.LookAt(GetAimPosition());
            }

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

            return(targetToTest != null && targetToTest.GetIsAlive());
        }
Example #3
0
        private void Update()
        {
            timeElapsed += Time.deltaTime;

            if (target == null)
            {
                return;
            }
            if (!target.GetIsAlive())
            {
                return;
            }

            if (!GetIsInRange())
            {
                GetComponent <Mover>().MoveTo(target.transform.position, 1f);
            }
            else
            {
                GetComponent <Mover>().Cancel();
                AttackBehaviour();
            }
        }