void SetCurrentTarget(IEcoTarget newTarget) { currentTarget = newTarget; if (newTarget != null && newTarget.GetGameObject() != null) { swimBehaviour.SwimTo(currentTarget.GetPosition(), swimVelocity); } }
private bool IsValidTarget(IEcoTarget target) { if (Random.value > 0.75f) { return(false); } if (target == null || target.GetGameObject() == null) { return(false); } return(Vector3.Distance(transform.position, target.GetPosition()) < 35f); }
public override float Evaluate(Creature creature) { if (frozen) { return(0f); } IEcoTarget closestTarget = EcoRegionManager.main.FindNearestTarget(targetType, transform.position, null, 1); if (closestTarget != null && closestTarget.GetGameObject() != null) { if (Vector3.Distance(closestTarget.GetPosition(), transform.position) < maxReactDistance) { performingAction = true; timeStopAction = Time.time + actionLength; if (lastScare) { lastScare.lastScarePosition = closestTarget.GetPosition(); } } } if (performingAction) { if (Time.time > timeStopAction) { performingAction = false; } } if (performingAction) { return(evaluatePriority); } else { return(0f); } }
private bool IsTargetValid(IEcoTarget target) { return(target.GetGameObject().GetComponentInParent <Player>() == null && (target.GetPosition() - this.creature.leashPosition).sqrMagnitude > 64f); }