public override bool ShouldTransition(Controller character, CharacterStateTransitionData data) { if ((data as StateFinishTransitionData).state.isFinished) { return(true); } return(false); }
//----------------------------------------------------------------------------------------------------------------- //public API Methods //----------------------------------------------------------------------------------------------------------------- //transition when the time specified is met public override bool ShouldTransition(Controller controller, CharacterStateTransitionData data) { //if our finishTime is more than game time then our transition is valid and we should transition. if ((data as TimeTransitionData).finishTime < Time.time) { return(true); } return(false); }
//----------------------------------------------------------------------------------------------------------------- //public API Methods //----------------------------------------------------------------------------------------------------------------- //transition if the distance to our target meets the distance specified public override bool ShouldTransition(Controller character, CharacterStateTransitionData data) { //check our position delta. Vector2 delta = (data as DistanceTransitionData).target.position - character.transform.position; //get the distance squared that we need to meet. float distanceSquared = (data as DistanceTransitionData).distance.Squared(); //check if the distance squared to target is less than the distance squared that we need to meet. if (delta.sqrMagnitude <= distanceSquared) { return(true); } return(false); }
//called when we want to know if we should transition out of state public virtual bool ShouldTransition(Controller controller, CharacterStateTransitionData data) { return(false); }