コード例 #1
0
 public override void OnExit()
 {
     if (!FsmEvent.IsNullOrEmpty(finishEvent))
     {
         mComp.clipFinishCallback -= FinishCallback;
     }
 }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
        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);
                }
            }
        }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
ファイル: MusicPlay.cs プロジェクト: toddef/MatePlayMaker
 // Code that runs when exiting the state.
 public override void OnExit()
 {
     if (!FsmEvent.IsNullOrEmpty(onFinishEvent))
     {
         MusicManager.instance.musicFinishCallback -= OnMusicFinish;
     }
 }
コード例 #7
0
        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);
                }
            }
        }
コード例 #8
0
        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);
                }
            }
        }
コード例 #9
0
        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;
                }
            }
        }
コード例 #10
0
        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);
                }
            }
        }
コード例 #11
0
        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);
                }
            }
        }
コード例 #12
0
        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();
                }
            }
        }
コード例 #13
0
        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();
        }
コード例 #14
0
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(sendEvent))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #15
0
ファイル: FloatWindowCompare.cs プロジェクト: K07H/The-Forest
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(this.inWindow) && FsmEvent.IsNullOrEmpty(this.outOfWindow))
     {
         return("Action sends no events!");
     }
     return(string.Empty);
 }
コード例 #16
0
ファイル: FloatSignTest.cs プロジェクト: DevZhav/The-Forest
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(this.isPositive) && FsmEvent.IsNullOrEmpty(this.isNegative))
     {
         return("Action sends no events!");
     }
     return(string.Empty);
 }
コード例 #17
0
ファイル: IntCompare.cs プロジェクト: smdx24/CPI-Source-Code
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(equal) && FsmEvent.IsNullOrEmpty(lessThan) && FsmEvent.IsNullOrEmpty(greaterThan))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #18
0
ファイル: IsFloatBetween.cs プロジェクト: Touge-svc/GGJ16
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(isTrue) &&
         FsmEvent.IsNullOrEmpty(isFalse))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #19
0
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(onPressEvent) &&
         FsmEvent.IsNullOrEmpty(onReleaseEvent))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #20
0
 public override string ErrorCheck()
 {
     if (everyFrame.Value &&
         FsmEvent.IsNullOrEmpty(isEqual) &&
         FsmEvent.IsNullOrEmpty(isNotEqual))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #21
0
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(equal) &&
         FsmEvent.IsNullOrEmpty(lessThan) &&
         FsmEvent.IsNullOrEmpty(greaterThan))
     {
         return("This action requires an event!");
     }
     return("");
 }
コード例 #22
0
        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);
                }
            }
        }
コード例 #23
0
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(swipeLeft) &&
         FsmEvent.IsNullOrEmpty(swipeRight) &&
         FsmEvent.IsNullOrEmpty(swipeUp) &&
         FsmEvent.IsNullOrEmpty(swipeDown))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #24
0
 public override string ErrorCheck()
 {
     if (FsmEvent.IsNullOrEmpty(Disconnected) &&
         FsmEvent.IsNullOrEmpty(Scanning) &&
         FsmEvent.IsNullOrEmpty(Connecting) &&
         FsmEvent.IsNullOrEmpty(Connected))
     {
         return("Action sends no events!");
     }
     return("");
 }
コード例 #25
0
 void OnSoundEnd(object param)
 {
     if (!FsmEvent.IsNullOrEmpty(onEndEvent))
     {
         Fsm.Event(onEndEvent);
     }
     else
     {
         Finish();
     }
 }
コード例 #26
0
        public override void OnUpdate()
        {
            if (!mComp.isPlaying)
            {
                if (!FsmEvent.IsNullOrEmpty(onEndEvent))
                {
                    Fsm.Event(onEndEvent);
                }

                Finish();
            }
        }
コード例 #27
0
 // 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;
     }
 }
コード例 #28
0
        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("");
        }
コード例 #29
0
ファイル: MusicPlay.cs プロジェクト: toddef/MatePlayMaker
 void OnMusicFinish(string name)
 {
     if (name == music.Value)
     {
         if (!FsmEvent.IsNullOrEmpty(onFinishEvent))
         {
             Fsm.Event(onFinishEvent);
         }
         else
         {
             Finish();
         }
     }
 }
コード例 #30
0
    void OnInput(InputManager.Info dat)
    {
        if (dat.state == InputManager.State.Pressed)
        {
            SetInput(false);

            if (!FsmEvent.IsNullOrEmpty(toEvent))
            {
                Fsm.Event(toEvent);
            }

            Finish();
        }
    }