Esempio n. 1
0
        public virtual void SetWaypoint(Entity target)
        {
            if (target == null)
            {
                return;
            }

            SetWaypoint(target.transform.position);
            targetEntityGameObject = target.gameObject;
        }
Esempio n. 2
0
 protected virtual bool HasHitTarget(Entity target)
 {
     return false;
 }
Esempio n. 3
0
 protected virtual void DealDamageToTarget(Entity target)
 {
 }
Esempio n. 4
0
        private void AttackTarget(Entity attackTarget)
        {
            if (attackTarget == null)
            {
                isAttacking = false;
                return;
            }

            Vector3 targetPosition = attackTarget.transform.position;
            bool targetInRange = IsTargetInRange(targetPosition);
            if (targetInRange == false)
            {
                AdvanceTowardsTarget(targetPosition);
                return;
            }

            bool targetInSights = IsTargetInSights(targetPosition);
            if (targetInSights == false)
            {
                GetBearingToTarget(targetPosition);
                return;
            }

            bool readyToFire = IsReadyToFire();
            if (readyToFire == false)
            {
                return;
            }

            FireWeaponAtTarget(attackTarget);
        }
Esempio n. 5
0
        protected virtual void SetAttackTarget(Entity target)
        {
            actionTarget = target;

            Vector3 targetPosition = actionTarget.transform.position;
            bool targetInRange = IsTargetInRange(targetPosition);
            if (targetInRange == true)
            {
                isAttacking = true;
                AttackTarget(actionTarget);
            }
            else
            {
                AdvanceTowardsTarget(targetPosition);
            }
        }
Esempio n. 6
0
        protected virtual void FireWeaponAtTarget(Entity target)
        {
            currentCooldownRemaining = WeaponCooldown;

            string ownersName = "Neutral";
            string attackTargetsOwnersName = ownersName;
            if (Owner != null)
            {
                ownersName = Owner.PlayerId.ToString();
            }

            Selectable attackTarget = target as Selectable;
            if (attackTarget == null)
            {
                Debug.Log(string.Format("{0} {1} fired at {2} {3}", ownersName, name, attackTargetsOwnersName, attackTarget.name));
                return;
            }

            if (attackTarget.Owner != null)
            {
                attackTargetsOwnersName = attackTarget.Owner.PlayerId.ToString();
            }

            Debug.Log(string.Format("{0} {1} fired at {2} {3}", ownersName, name, attackTargetsOwnersName, attackTarget.name));
        }
Esempio n. 7
0
 protected void OtherEntitySetup(Entity entity, string entityType)
 {
     switch (entityType)
     {
         case PlayerProperties.STRUCTURES:
             Structure structure = (Structure)entity;
             if (structure.IsConstructionComplete == false)
             {
                 structure.SetTransparencyMaterial(AllowedMaterial, true);
             }
             break;
     }
 }