public virtual void SetWaypoint(Entity target) { if (target == null) { return; } SetWaypoint(target.transform.position); targetEntityGameObject = target.gameObject; }
protected virtual bool HasHitTarget(Entity target) { return false; }
protected virtual void DealDamageToTarget(Entity target) { }
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); }
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); } }
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)); }
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; } }