Exemplo n.º 1
0
    /// <summary>
    /// Move to first person mode.
    /// </summary>
    /// <param name="shooter"></param>
    public void TransitionToFirstPerson(Shooter shooter)
    {
        // Already in this state, return.
        if (m_currentMode == CameraMode.FirstPerson)
        {
            return;
        }

        // Get the destination
        m_lastOrthoPosition = transform.position;
        m_lastOrthoRotation = transform.rotation;
        m_desiredPosition   = shooter.CameraSocket.position;
        m_desiredRotation   = shooter.CameraSocket.rotation;

        // Toggle it to Perspective
        GetComponent <MatrixBlender>().BlendToMatrix(m_perspective, CameraLerpTime, MatrixLerpEase, false);
        //GetComponent<Camera>().projectionMatrix = Matrix4x4.Perspective(FOV, 16f/9f, zNear, zFar);

        // Hide the 3rd person canvas.
        GameManager.Instance.GameCanvas.ThirdPersonTutorial.gameObject.SetActive(false);

        // Change the state machine state
        m_currentMode      = CameraMode.FirstPerson;
        m_firstPersonState = new GameCameraFirstPersonState();
        m_firstPersonState.SetShooter(shooter);
        m_stateMachine.ChangeState(m_firstPersonState);

        // Move the camera
        StartCoroutine(LerpCameraToRotation(() =>
        {
            // Show the First Person Canvas.
            GameManager.Instance.GameCanvas.FirstPersonCanvas.gameObject.SetActive(true);
        }));
    }
Exemplo n.º 2
0
 public virtual void ChangeState(LeapState ls)
 {
     if (ls != null)
     {
         stateController.ChangeState(ls);
     }
 }
Exemplo n.º 3
0
    void PlayerTurn()
    {
        if (HasAllMoved(Players))
        {
            Debug.Log("FRIENDLY");

            dungeonStateMachine.ChangeState((int)CharacterFaction.FRIENDLY);
        }
    }
Exemplo n.º 4
0
    void Move()
    {
        if (Input.GetButtonDown("Turn"))
        {
            stateMachine.ChangeState((int)PlayerInputStates.TURN);
        }

        SetArrowRotation(input);
        dungeonCharacter.Move(input);
    }
Exemplo n.º 5
0
    //Trigger callback function
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "EnemyTag")
        {
            Debug.Log("Carrot trigger enter");
            indexOfLife--;


            Animator cloudAnimator = cloud.GetComponent <Animator>();
            cloudAnimator.Play("Cloud");

            AudioSource aud = cloud.GetComponent <AudioSource>();
            aud.Play();

            switch (indexOfLife + 1)
            {
            case 10:
            case 9:
            case 8:
                fsm.ChangeState(States.life10);
                break;

            case 7:
                fsm.ChangeState(States.life7);
                break;

            case 6:
                fsm.ChangeState(States.life6);
                break;

            case 5:
                fsm.ChangeState(States.life5);
                break;

            case 4:
                fsm.ChangeState(States.life4);
                break;

            case 3:
                fsm.ChangeState(States.life3);
                break;

            case 2:
                fsm.ChangeState(States.life2);
                break;

            case 1:
                fsm.ChangeState(States.life1);
                break;

            default:
                break;
            }
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        _xInput               = Player.InputHandler.NormalizedInputX;
        _attackCount          = Player.InputHandler.PrimaryAttackClickCount;
        _isAttemptingToAttack = Player.InputHandler.PrimaryAttackInput;

        Player.CheckIfShouldFlip(_xInput);
        Player.SetVelocityX(_playerSwordAttackData.attackVelocity * _xInput);

        if (IsExitingState && _isAttemptingToAttack)
        {
            if (_attackCount == Player.SwordAttackState01._playerSwordAttackData.comboAttackIndex)
            {
                FiniteStateMachine.ChangeState(Player.SwordAttackState01);
            }
            else if (_attackCount == Player.SwordAttackState02._playerSwordAttackData.comboAttackIndex)
            {
                FiniteStateMachine.ChangeState(Player.SwordAttackState02);
            }
            else if (_attackCount == Player.SwordAttackState03._playerSwordAttackData.comboAttackIndex)
            {
                FiniteStateMachine.ChangeState(Player.SwordAttackState03);
            }
        }
    }
Exemplo n.º 7
0
    void Awake()
    {
        mainFSM = new FiniteStateMachine<State>();
        mainFSM.AddTransition(State.Initialize, State.SetupNewGame, null, InitializeNewGame, OnSettingUpNewGame);
        mainFSM.AddTransition(State.SetupNewGame, State.Game, null, () => StartCoroutine(InitializeGameLogicStuff()), null);
        mainFSM.AddTransition(State.Game, State.GameOver, OnGameIsOver);
        mainFSM.AddTransition(State.GameOver, State.Restart, null);
        mainFSM.AddTransition(State.Restart, State.SetupNewGame, null, InitializeNewGame, null);
        mainFSM.AddTransition(State.Restart, State.Quit, null);
        mainFSM.StateChanged += (object s, EventArgs e) => {
            Debug.Log("state: " + mainFSM.CurrentState.ToString() + " | game state: " + gameFSM.CurrentState.ToString());
        };

        gameFSM = new FiniteStateMachine<GameState>();
        gameFSM.AddTransition(GameState.Idle, GameState.InGameMenu, OnInGameMenuOpened);
        gameFSM.AddTransition(GameState.InGameMenu, GameState.Idle, OnInGameMenuClosed);
        gameFSM.StateChanged += (object s, EventArgs e) => {
            Debug.Log("state: " + mainFSM.CurrentState.ToString() + " | game state: " + gameFSM.CurrentState.ToString());
        };

        GameIsOver += (object s, EventArgs e) => { Debug.Log("oh no!"); };
        InGameMenuOpened += (object s, EventArgs e) => { Time.timeScale = 0f; Debug.Log("PAUSED"); };
        InGameMenuClosed += (object s, EventArgs e) => { Time.timeScale = 1f; Debug.Log("UNPAUSED"); };

        igm = GetComponent<InGameMenu>();
        mainFSM.ChangeState(State.SetupNewGame);
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (ShouldPerformCloseRangeAction && IsPlayerInMinAgroRange)
        {
            if (Time.time >= _goblinArcher.DodgeState.LastDodgeTime + _goblinArcher._dodgeStateData.dodgeCooldwon)
            {
                _goblinArcher.DodgeState.ShouldFlipAfterDodge(IsDetectingWallBehind);
                _goblinArcher.DodgeState.ShouldDodgeInOppositeDirection(IsDetectingWallBehind);
                FiniteStateMachine.ChangeState(_goblinArcher.DodgeState);
            }
            else
            {
                FiniteStateMachine.ChangeState(_goblinArcher.MeleeAttackState);
            }
        }
        else if (ShouldPerformLongRangeAction && IsPlayerInMaxAgroRange)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.RangedAttackState);
        }
        else if (!IsDetectingLedge || IsDetectingWall)
        {
            Enemy.Flip();
            FiniteStateMachine.ChangeState(_goblinArcher.MoveState);
        }
        else if (!IsPlayerInMaxAgroRange)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.LookForPlayerState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        XInput    = Player.InputHandler.NormalizedInputX;
        YInput    = Player.InputHandler.NormalizedInputY;
        GrabInput = Player.InputHandler.GrabInput;
        JumpInput = Player.InputHandler.JumpInput;

        if (JumpInput)
        {
            Player.WallJumpState.DetermineWallJumpDirection(IsTouchingWall);
            FiniteStateMachine.ChangeState(Player.WallJumpState);
        }
        else if (IsGrounded && !GrabInput)
        {
            FiniteStateMachine.ChangeState(Player.IdleState);
        }
        else if (!IsTouchingWall || (XInput != Player.FacingDirection && !GrabInput))
        {
            FiniteStateMachine.ChangeState(Player.InAirState);
        }
        else if (IsTouchingWall && !IsTouchingLedge)
        {
            FiniteStateMachine.ChangeState(Player.LedgeClimbState);
        }
    }
Exemplo n.º 10
0
    public void Start()
    {
        CurrentMap   = new MapGenerator().Generate(10, 10);
        CurrentCoord = CurrentMap.Entrance.Coord;

        _fsm.ChangeState(new FSMTransition(GameState.MapEnter));
    }
Exemplo n.º 11
0
 public override void TransitionCheck(GameObject box, GameObject target)
 {
     if (box.transform.position.x < target.transform.position.x && box.transform.position.x - target.transform.position.x > -farDistance)
     {
         FiniteStateMachine.ChangeState(new LeftState());
     }
 }
Exemplo n.º 12
0
    public override void Damage(AttackDetails attackDetails)
    {
        if (DeadState.IsDead)
        {
            return;
        }

        bool canDamage = Time.time >= StatsManager.LastDamageTime + _damageStateData.timeBeforeNextDamage;

        base.Damage(attackDetails);

        foreach (GameObject hitPartcile in _damageStateData.hitPartciles)
        {
            GameObject.Instantiate(hitPartcile, AliveGameObject.transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0, 360)));
        }

        if (StatsManager.IsDead)
        {
            FiniteStateMachine.ChangeState(DeadState);
        }
        else if (canDamage)
        {
            FiniteStateMachine.ChangeState(DamageState);
        }
    }
Exemplo n.º 13
0
 public void ChangeStatus(RoleState state)
 {
     if (m_fsm.GetCurrentState() == state)
     {
         return;
     }
     m_fsm.ChangeState(state);
 }
Exemplo n.º 14
0
    protected void Awake()
    {
        _fsm = new FiniteStateMachine();

        _fsm.AddState(new MonsterWanderState(gameObject));

        _fsm.ChangeState(new FSMTransition(MonsterState.Wander));
    }
Exemplo n.º 15
0
    protected void Awake()
    {
        _fsm = new FiniteStateMachine();

        _fsm.AddState(new MonsterWanderState(gameObject));

        _fsm.ChangeState(new FSMTransition(MonsterState.Wander));
    }
    void Start()
    {
        fsm = new FiniteStateMachine <ServerPlayer>(this);

        connection = GetComponent <Connection>();
        Assert.IsNotNull(connection);

        fsm.ChangeState <ServerPlayerStateAwaitingServerJoinRequest>();
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsAnimationFinished)
        {
            FiniteStateMachine.ChangeState(_slime.IdleState);
        }
    }
Exemplo n.º 18
0
        public void Test()
        {
            Random r = new Random();

            for (int i = 0; i < 125; i++)
            {
                int s = r.Next(0, 4);
                fsm.ChangeState((GameState)s);
            }
        }
Exemplo n.º 19
0
	protected void Awake() {
		_fsm = new FiniteStateMachine();

		_fsm.AddState(new GameCreateState());
		_fsm.AddState(new GameResetState());
		_fsm.AddState(new GamePlayState());
		_fsm.AddState(new GameWinState());
		_fsm.AddState(new GameLoseState());

		_fsm.ChangeState(new FSMTransition(GameState.GameCreate));
	}
Exemplo n.º 20
0
    void Start()
    {
        controller = GetComponent <CharacterController>();

        stateMachine = new FiniteStateMachine <SmartEnemy>();
        stateMachine.Init(this);

        EnemyPatrolState newState = new EnemyPatrolState();

        stateMachine.ChangeState(newState);
    }
Exemplo n.º 21
0
 public void ChangeState(FSMState <MainMenu> state, bool isGlobalState = false)
 {
     frameSkip = 2;
     if (isGlobalState)
     {
         stateMachine.ChangeGlobalState(state);
     }
     else
     {
         stateMachine.ChangeState(state);
     }
 }
Exemplo n.º 22
0
 public override void TransitionCheck(GameObject box, GameObject target)
 {
     if (box.transform.position.x > target.transform.position.x && box.transform.position.x - target.transform.position.x < farDistance)
     {
         Debug.Log("Changing to right from fr");
         FiniteStateMachine.ChangeState(new RightState());
     }
     else
     {
         Debug.Log("I am Far right");
     }
 }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsPlayerInMinAgroRange || IsPlayerInMaxAgroRange)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.PlayerDetectedState);
        }
        else if (IsIdleTimeOver)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.MoveState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsPlayerInMaxAgroRange)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.PlayerDetectedState);
        }
        else if (AreAllTurnsTimeDone)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.MoveState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsPlayerInMinAgroRange)
        {
            FinishAttack();
        }
        else
        {
            FiniteStateMachine.ChangeState(_boar.PlayerDetectedState);
        }
    }
Exemplo n.º 26
0
    public void ChangePlayingState(States newState)
    {
        States oldState = _playingStateMachine.GetCurrentState <States>();

        if (newState != oldState || newState == States.NullState)
        {
            Debug.Log("Change Playing State : " + newState);

            _playingStateMachine.ChangeState <States>(newState);

            Resolver.Instance.GetController <EventHandler>().Post(Events.PlayingStateTransition.TransitionAway, oldState);
            Resolver.Instance.GetController <EventHandler>().Post(Events.PlayingStateTransition.TransitionTo, newState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (!IsExitingState)
        {
            Player.SetVelocityY(-PlayerData.wallSlideVelocity);

            if (GrabInput && YInput == 0)
            {
                FiniteStateMachine.ChangeState(Player.WallGrabState);
            }
        }
    }
Exemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        fsm         = new FiniteStateMachine <BottleDefense, BottleDefense.StatesOfDefense>(this);
        bottleLevel = 1;
        enemyArray  = new ArrayList(0);

        fsm.RegisterState(stateIdle);
        fsm.RegisterState(stateAttack);
        fsm.RegisterState(stateLevelup);

        //1:if in the range had an enemy,set attackstatus
        //2:if no enemy,set idlestatus.
        fsm.ChangeState(stateIdle);
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsPlayerInMaxAgroRange)
        {
            FiniteStateMachine.ChangeState(_goblinArcher.PlayerDetectedState);
        }
        else if (!IsDetectingLedge || IsDetectingWall)
        {
            _goblinArcher.IdleState.ShouldFlipAfterIdle(true);
            FiniteStateMachine.ChangeState(_goblinArcher.IdleState);
        }
    }
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (!IsExitingState)
        {
            Player.SetVelocityY(PlayerData.wallClimbVelocity);

            if (YInput != 1)
            {
                FiniteStateMachine.ChangeState(Player.WallGrabState);
            }
        }
    }
Exemplo n.º 31
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (!isDetectingLedge || IsDetectingWall)
        {
            _boar.IdleState.ShouldFlipAfterIdle(true);
            FiniteStateMachine.ChangeState(_boar.IdleState);
        }
        else if (HasStopped && IsMinSlideTimeOver)
        {
            _boar.LookForPlayerState.SetShouldTurnImmediately(true);
            FiniteStateMachine.ChangeState(_boar.LookForPlayerState);
        }
    }
Exemplo n.º 32
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsPlayerInMaxAgroRange)
        {
            ShouldFlipAfterIdle(false);
            FiniteStateMachine.ChangeState(_slime.PlayerDetectedState);
        }
        else if (IsIdleTimeOver)
        {
            ShouldFlipAfterIdle(!IsDetectingLedge || IsDetectingWall);
            FiniteStateMachine.ChangeState(_slime.JumpingMoveState);
        }
    }
Exemplo n.º 33
0
    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (IsAnimationFinished)
        {
            if (IsPlayerInMaxAgroRange)
            {
                FiniteStateMachine.ChangeState(_ogre.PlayerDetectedState);
            }
            else
            {
                FiniteStateMachine.ChangeState(_ogre.LookForPlayerState);
            }
        }
    }
    static void DebugClickTimedToggle(FiniteStateMachine fsm)
    {
        FiniteState start_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState red_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState green_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        start_state.StateName = "Start";
        red_state.StateName = "Red";
        green_state.StateName = "Green";

        {
            red_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = red_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.red;
        }

        {
            green_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = green_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.green;
        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(start_state,typeof(Transitions.OnMouseClick),red_state) as Transitions.OnMouseClick;
            t.Name = "click_start";

        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(red_state,typeof(Transitions.OnMouseClick),green_state) as Transitions.OnMouseClick;
            t.Name = "click_red";

        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(green_state,typeof(Transitions.OnMouseClick),red_state) as Transitions.OnMouseClick;
            t.Name = "click_green";

        }
        {
            Transitions.OnTimer2 t = fsm.AddTransition(green_state,typeof(Transitions.OnTimer2),red_state) as Transitions.OnTimer2;
            t.Name = "click_green";

            t.Delay = 2;
        }
        fsm.ChangeState(start_state);
    }
    static void DebugToggleMultiColor(FiniteStateMachine fsm)
    {
        FiniteState start_state 	=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState red_state 		=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState green_state 	=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState blue_state 		=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState yellow_state 	=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState magenta_state 	=  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();

        start_state.StateName 	= "Start";
        red_state.StateName 		= "Red";
        green_state.StateName 	= "Green";
        blue_state.StateName 	= "blue";
        yellow_state.StateName 	= "yellow";
        magenta_state.StateName 	= "magenta";

        {
            red_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = red_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.red;
        }

        {
            green_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = green_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.green;
        }

        {
            blue_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = blue_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.blue;
        }

        {
            yellow_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = yellow_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.yellow;
        }
        {
            magenta_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = magenta_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.magenta;
        }

        {
            Transitions.OnTimer2 t = fsm.AddTransition(start_state,typeof(Transitions.OnTimer2),red_state) as Transitions.OnTimer2;
            t.Name = "timer_start";

            t.Delay = 1.0f;
        }

        {
            Transitions.OnTimer2 t = fsm.AddTransition(red_state,typeof(Transitions.OnTimer2),green_state) as Transitions.OnTimer2;
            t.Name = "timer_red";

            t.Delay = Random.value * 10.0f;
        }
        {
            Transitions.OnTimer2 t = fsm.AddTransition(green_state,typeof(Transitions.OnTimer2),blue_state) as Transitions.OnTimer2;
            t.Name = "timer_green";

            t.Delay = Random.value * 10.0f;
        }
        {
            Transitions.OnTimer2 t = fsm.AddTransition(blue_state,typeof(Transitions.OnTimer2),yellow_state) as Transitions.OnTimer2;
            t.Name = "timer_blue";

            t.Delay = Random.value * 10.0f;
        }
        {
            Transitions.OnTimer2 t = fsm.AddTransition(yellow_state,typeof(Transitions.OnTimer2),magenta_state) as Transitions.OnTimer2;
            t.Name = "timer_yellow";

            t.Delay = Random.value * 10.0f;
        }
        {
            Transitions.OnTimer2 t = fsm.AddTransition(magenta_state,typeof(Transitions.OnTimer2),red_state) as Transitions.OnTimer2;
            t.Name = "timer_magenta";

            t.Delay = Random.value * 10.0f;
        }
        fsm.ChangeState(start_state);
    }
    static void DebugTest(FiniteStateMachine fsm)
    {
        FiniteState start_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState red_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState green_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();

        start_state.StateName = "Start";
        red_state.StateName = "Red";
        green_state.StateName = "Green";

        {
            red_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = red_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.red;
        }

        {
            red_state.ExitAction = fsm.gameObject.AddComponent<StateActions.SA_SetVariable>() as IStateAction;
            StateActions.SA_SetVariable sa = red_state.ExitAction as StateActions.SA_SetVariable;
            sa.Value = new Vector3(1,2,3);
        }

        {
            green_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_ChangeColor>() as IStateAction;
            StateActions.SA_ChangeColor sa = green_state.EnterAction as StateActions.SA_ChangeColor;
            sa.NewColor = Color.green;
        }

        {
            green_state.ExitAction = fsm.gameObject.AddComponent<StateActions.SA_SetScriptVariable>() as IStateAction;
            StateActions.SA_SetScriptVariable sa = green_state.ExitAction as StateActions.SA_SetScriptVariable;
            sa.ScriptName = "SimpleScript";
            sa.ValueName = "Position";
            sa.Value = new Vector3(42,43,44);
        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(start_state,typeof(Transitions.OnMouseClick),red_state) as Transitions.OnMouseClick;
            t.Name = "click_start";

        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(red_state,typeof(Transitions.OnMouseClick),green_state) as Transitions.OnMouseClick;
            t.Name = "click_red";

        }

        {
            Transitions.OnMouseClick t = fsm.AddTransition(green_state,typeof(Transitions.OnMouseClick),red_state) as Transitions.OnMouseClick;
            t.Name = "click_green";

        }
        fsm.ChangeState(start_state);
    }
    static void DebugPressurePlateLight(FiniteStateMachine fsm)
    {
        FiniteState unpressed_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState pressed_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();

        {
            //unpressed_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_PressurePlateLight>() as IStateAction;
            //StateActions.SA_PressurePlateLight sa = unpressed_state.EnterAction as StateActions.SA_PressurePlateLight;
            //sa.State = false;
        }

        {
            pressed_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_PressurePlateLight>() as IStateAction;
            StateActions.SA_PressurePlateLight sa = pressed_state.EnterAction as StateActions.SA_PressurePlateLight;
            sa.State = true;
        }

        {
            Transitions.OnTriggerEnterTransition t = fsm.AddTransition(unpressed_state,typeof(Transitions.OnTriggerEnterTransition),pressed_state) as Transitions.OnTriggerEnterTransition;
            t.Name = "trigger_enter";

        }

        {
            Transitions.OnTriggerExitTransition t = fsm.AddTransition(pressed_state,typeof(Transitions.OnTriggerExitTransition),unpressed_state) as Transitions.OnTriggerExitTransition;
            t.Name = "trigger_exit";

        }
        fsm.ChangeState(unpressed_state);
    }
    static void DebugPressurePlate(FiniteStateMachine fsm)
    {
        FiniteState unpressed_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();
        FiniteState pressed_state =  new FiniteState();//ScriptableObject.CreateInstance<FiniteState>();

        {
            unpressed_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_PressurePlateColor>() as IStateAction;
            StateActions.SA_PressurePlateColor sa = unpressed_state.EnterAction as StateActions.SA_PressurePlateColor;
            sa.NewColor = Color.red;
        }

        {
            pressed_state.EnterAction = fsm.gameObject.AddComponent<StateActions.SA_PressurePlateColor>() as IStateAction;
            StateActions.SA_PressurePlateColor sa = pressed_state.EnterAction as StateActions.SA_PressurePlateColor;
            sa.NewColor = Color.green;
        }

        {
            Transitions.OnTriggerEnterTransition t = fsm.AddTransition(unpressed_state,typeof(Transitions.OnTriggerEnterTransition),pressed_state) as Transitions.OnTriggerEnterTransition;
            t.Name = "trigger_enter";

        }

        {
            Transitions.OnTriggerExitTransition t = fsm.AddTransition(pressed_state,typeof(Transitions.OnTriggerExitTransition),unpressed_state) as Transitions.OnTriggerExitTransition;
            t.Name = "trigger_exit";

        }
        fsm.ChangeState(unpressed_state);
    }