public override void OnExit() { if (!FsmEvent.IsNullOrEmpty(finishEvent)) { mComp.clipFinishCallback -= FinishCallback; } }
void DoSamplePath() { if (_agent == null) { return; } UnityEngine.AI.NavMeshHit _NavMeshHit; bool _reachedBeforeMaxDistance = _agent.SamplePathPosition(passableMask.Value, maxDistance.Value, out _NavMeshHit); reachedBeforeMaxDistance.Value = _reachedBeforeMaxDistance; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_reachedBeforeMaxDistance) { if (!FsmEvent.IsNullOrEmpty(reachedBeforeMaxDistanceEvent)) { Fsm.Event(reachedBeforeMaxDistanceEvent); } } else { if (!FsmEvent.IsNullOrEmpty(reachedAfterMaxDistanceEvent)) { Fsm.Event(reachedAfterMaxDistanceEvent); } } }
void DoGetDistancetoEdge() { NavMeshHit _NavMeshHit; bool _nearestEdgeFound = NavMesh.FindClosestEdge(sourcePosition.Value, out _NavMeshHit, passableMask.Value); nearestEdgeFound.Value = _nearestEdgeFound; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_nearestEdgeFound) { if (!FsmEvent.IsNullOrEmpty(nearestEdgeFoundEvent)) { Fsm.Event(nearestEdgeFoundEvent); } } else { if (!FsmEvent.IsNullOrEmpty(nearestEdgeNotFoundEvent)) { Fsm.Event(nearestEdgeNotFoundEvent); } } }
void DoFindClosestEdge() { if (_agent == null) { return; } NavMeshHit _NavMeshHit; bool _nearestEdgeFound = _agent.FindClosestEdge(out _NavMeshHit); nearestEdgeFound.Value = _nearestEdgeFound; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_nearestEdgeFound) { if (!FsmEvent.IsNullOrEmpty(nearestEdgeFoundEvent)) { Fsm.Event(nearestEdgeFoundEvent); } } else { if (!FsmEvent.IsNullOrEmpty(nearestEdgeNotFoundEvent)) { Fsm.Event(nearestEdgeNotFoundEvent); } } }
void DoRaycast() { if (_agent == null) { return; } UnityEngine.AI.NavMeshHit _NavMeshHit; bool _reachedBeforeTargetPosition = _agent.Raycast(targetPosition.Value, out _NavMeshHit); reachedBeforeTargetPosition.Value = _reachedBeforeTargetPosition; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_reachedBeforeTargetPosition) { if (!FsmEvent.IsNullOrEmpty(reachedBeforeTargetPositionEvent)) { Fsm.Event(reachedBeforeTargetPositionEvent); } } else { if (!FsmEvent.IsNullOrEmpty(reachedAfterTargetPositionEvent)) { Fsm.Event(reachedAfterTargetPositionEvent); } } }
// Code that runs when exiting the state. public override void OnExit() { if (!FsmEvent.IsNullOrEmpty(onFinishEvent)) { MusicManager.instance.musicFinishCallback -= OnMusicFinish; } }
void DoSamplePosition() { UnityEngine.AI.NavMeshHit _NavMeshHit; bool _nearestPointFound = UnityEngine.AI.NavMesh.SamplePosition(sourcePosition.Value, out _NavMeshHit, maxDistance.Value, allowedMask.Value); nearestPointFound.Value = _nearestPointFound; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_nearestPointFound) { if (!FsmEvent.IsNullOrEmpty(nearestPointFoundEvent)) { Fsm.Event(nearestPointFoundEvent); } } else { if (!FsmEvent.IsNullOrEmpty(nearestPointNotFoundEvent)) { Fsm.Event(nearestPointNotFoundEvent); } } }
void DoRaycast() { UnityEngine.AI.NavMeshHit _NavMeshHit; bool _reachedBeforeTargetPosition = UnityEngine.AI.NavMesh.Raycast(sourcePosition.Value, targetPosition.Value, out _NavMeshHit, passableMask.Value); reachedBeforeTargetPosition.Value = _reachedBeforeTargetPosition; position.Value = _NavMeshHit.position; normal.Value = _NavMeshHit.normal; distance.Value = _NavMeshHit.distance; mask.Value = _NavMeshHit.mask; hit.Value = _NavMeshHit.hit; if (_reachedBeforeTargetPosition) { if (!FsmEvent.IsNullOrEmpty(reachedBeforeTargetPositionEvent)) { Fsm.Event(reachedBeforeTargetPositionEvent); } } else { if (!FsmEvent.IsNullOrEmpty(reachedAfterTargetPositionEvent)) { Fsm.Event(reachedAfterTargetPositionEvent); } } }
void EventUpdate() { if (input.IsNone || !input.Value) { return; } var action = (InputAction)input.Value; var newState = action.GetButtonState(); //state has changed if (mCurState != newState) { mCurState = newState; switch (mCurState) { case InputAction.ButtonState.Pressed: if (!FsmEvent.IsNullOrEmpty(pressedEvent)) { Fsm.Event(pressedEvent); } break; case InputAction.ButtonState.Released: if (!FsmEvent.IsNullOrEmpty(releasedEvent)) { Fsm.Event(releasedEvent); } break; } } }
void DoCalculatePath() { _getNavMeshPathProxy(); if (_NavMeshPathProxy == null) { return; } UnityEngine.AI.NavMeshPath _path = new UnityEngine.AI.NavMeshPath(); bool _found = UnityEngine.AI.NavMesh.CalculatePath(sourcePosition.Value, targetPosition.Value, passableMask.Value, _path); _NavMeshPathProxy.path = _path; resultingPathFound.Value = _found; if (_found) { if (!FsmEvent.IsNullOrEmpty(resultingPathFoundEvent)) { Fsm.Event(resultingPathFoundEvent); } } else { if (!FsmEvent.IsNullOrEmpty(resultingPathNotFoundEvent)) { Fsm.Event(resultingPathNotFoundEvent); } } }
void DoSetPath() { if (_pathProxy == null || _agent == null) { return; } bool _ok = NewMethod(); pathAssigned.Value = _ok; if (_ok) { if (!FsmEvent.IsNullOrEmpty(pathAssignedEvent)) { Fsm.Event(pathAssignedEvent); } } else { if (!FsmEvent.IsNullOrEmpty(pathNotAssignedEvent)) { Fsm.Event(pathNotAssignedEvent); } } }
void OnAction(UIModalCharacterDialog dlg, int choiceIndex) { if (mCurIndex == textIndexEnd.Value) { //save to variable if (!choiceOutput.IsNone) { choiceOutput.Value = choiceIndex; } //close? if (closeOnAction.Value && UIModalManager.instance.ModalGetTop() == GetModalRef()) { UIModalManager.instance.ModalCloseTop(); } //envoke event if (!FsmEvent.IsNullOrEmpty(actionEvent)) { Fsm.Event(actionEvent); } Finish(); } else { //go to next mCurIndex++; if (!SetDialog(false)) { Finish(); } } }
void StateCallback(string aName, SceneState.StateValue newVal) { if (!output.IsNone) { switch (output.Type) { case VariableType.Int: output.SetValue(newVal.ival); break; case VariableType.Float: output.SetValue(newVal.fval); break; case VariableType.String: output.SetValue(newVal.sval); break; case VariableType.Bool: output.SetValue(newVal.ival != 0); break; } } if (!FsmEvent.IsNullOrEmpty(changeEvent)) { Fsm.Event(changeEvent); } Finish(); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(sendEvent)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(this.inWindow) && FsmEvent.IsNullOrEmpty(this.outOfWindow)) { return("Action sends no events!"); } return(string.Empty); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(this.isPositive) && FsmEvent.IsNullOrEmpty(this.isNegative)) { return("Action sends no events!"); } return(string.Empty); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(equal) && FsmEvent.IsNullOrEmpty(lessThan) && FsmEvent.IsNullOrEmpty(greaterThan)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(isTrue) && FsmEvent.IsNullOrEmpty(isFalse)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(onPressEvent) && FsmEvent.IsNullOrEmpty(onReleaseEvent)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (everyFrame.Value && FsmEvent.IsNullOrEmpty(isEqual) && FsmEvent.IsNullOrEmpty(isNotEqual)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(equal) && FsmEvent.IsNullOrEmpty(lessThan) && FsmEvent.IsNullOrEmpty(greaterThan)) { return("This action requires an event!"); } return(""); }
void DoCalculatePath() { GameObject _sourceGameObject = Fsm.GetOwnerDefaultTarget(sourceGameObject); if (_sourceGameObject == null) { return; } GameObject _targetGameObject = targetGameObject.Value; if (_targetGameObject == null) { return; } _getNavMeshPathProxy(); UnityEngine.AI.NavMeshPath _path = new UnityEngine.AI.NavMeshPath(); bool _found = UnityEngine.AI.NavMesh.CalculatePath(_sourceGameObject.transform.position, _targetGameObject.transform.position, passableMask.Value, _path); if (_NavMeshPathProxy != null) { _NavMeshPathProxy.path = _path; } if (!calculatedPathCorners.IsNone) { calculatedPathCorners.Resize(_path.corners.Length); for (int i = 0; i < calculatedPathCorners.Length; i++) { calculatedPathCorners.Set(i, _path.corners [i]); } calculatedPathCorners.SaveChanges(); } resultingPathFound.Value = _found; if (_found) { if (!FsmEvent.IsNullOrEmpty(resultingPathFoundEvent)) { Fsm.Event(resultingPathFoundEvent); } } else { if (!FsmEvent.IsNullOrEmpty(resultingPathNotFoundEvent)) { Fsm.Event(resultingPathNotFoundEvent); } } }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(swipeLeft) && FsmEvent.IsNullOrEmpty(swipeRight) && FsmEvent.IsNullOrEmpty(swipeUp) && FsmEvent.IsNullOrEmpty(swipeDown)) { return("Action sends no events!"); } return(""); }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(Disconnected) && FsmEvent.IsNullOrEmpty(Scanning) && FsmEvent.IsNullOrEmpty(Connecting) && FsmEvent.IsNullOrEmpty(Connected)) { return("Action sends no events!"); } return(""); }
void OnSoundEnd(object param) { if (!FsmEvent.IsNullOrEmpty(onEndEvent)) { Fsm.Event(onEndEvent); } else { Finish(); } }
public override void OnUpdate() { if (!mComp.isPlaying) { if (!FsmEvent.IsNullOrEmpty(onEndEvent)) { Fsm.Event(onEndEvent); } Finish(); } }
// Code that runs on entering the state. public override void OnEnter() { base.OnEnter(); mComp.PlayOverrideClip(clip.Value); if (FsmEvent.IsNullOrEmpty(finishEvent)) { Finish(); } else { mComp.clipFinishCallback += FinishCallback; } }
public override string ErrorCheck() { if (FsmEvent.IsNullOrEmpty(equal) && FsmEvent.IsNullOrEmpty(notEqual)) { return("Action sends no events!"); } if (integers.Length < 2) { return("Action needs more than 1 int to compare"); } return(""); }
void OnMusicFinish(string name) { if (name == music.Value) { if (!FsmEvent.IsNullOrEmpty(onFinishEvent)) { Fsm.Event(onFinishEvent); } else { Finish(); } } }
void OnInput(InputManager.Info dat) { if (dat.state == InputManager.State.Pressed) { SetInput(false); if (!FsmEvent.IsNullOrEmpty(toEvent)) { Fsm.Event(toEvent); } Finish(); } }