/// <summary> /// Updates this CombatAction. /// </summary> /// <param name="timeStep">How much to update the action</param> public void Update(float timeStep) { if (isFinished) { return; } // Check whether we are in range of the target if (!isWithinRange) { if (StratusDetection.CheckRange(User.transform, Target.transform, this.Range)) { isWithinRange = true; this.Start(User, Target); //this.User.gameObject.Dispatch<Movement.EndedEvent>(new Movement.EndedEvent()); } } // Once within range of the target, start casting the action else { //Cast(this.User, this.Target, timeStep); switch (this.currentPhase) { case Phase.Casting: Cast(this.User, this.Target, timeStep); break; case Phase.Trigger: break; } } }
/// <summary> /// Checks line of sight with the given target /// </summary> /// <param name="target"></param> /// <returns></returns> public bool CheckLineOfSight(Transform target) { if (CheckFieldOfView(target)) { return(StratusDetection.CheckLineOfSight(this.root, target, range)); } return(false); }
/// <summary> /// Checks whether the target is in the field of view of the owner. /// </summary> /// <returns></returns> public bool CheckFieldOfView(Transform target) { if (CheckDistance(target)) { return(StratusDetection.CheckFieldOfView(this.root, target, selectedFov)); } return(false); }
//------------------------------------------------------------------------/ // Methods //------------------------------------------------------------------------/ /// <summary> /// Checks whether the agent is within range of its target /// </summary> /// <returns></returns> protected bool IsWithinRange(StratusAgent agent, Vector3 targetPosition) { return(StratusDetection.CheckRange(agent.transform, targetPosition, this.range)); }
private void DrawFieldOfView() { StratusDetection.DrawFieldOfView(root, selectedFov, range, detectionColor, true); }
private void DrawDetectionRange() { StratusDetection.DrawRange(root, range, detectionColor); }
private void DrawInteractionSphere() { StratusDetection.DrawRange(root, interactionRadius, interactionColor); }
/// <summary> /// Checks whether this sensor can interact with the target /// </summary> /// <param name="target"></param> /// <returns></returns> public bool CanInteract(Transform target) { return(StratusDetection.CheckRange(this.root, target, this.interactionRadius)); }
/// <summary> /// Checks whether the target is in range /// </summary> /// <returns></returns> public bool CheckDistance(Transform target) { return(StratusDetection.CheckRange(this.root, target, this.range)); }