Inheritance: IPlayerState
Exemple #1
0
    private void Search()
    {
        ChangeState();

        stuckTimer += Time.deltaTime;
        if (stuckTimer > 30f)
        {
            stuckTimer = 0f;
            dState     = DeathState.Flee;
        }

        NavMeshHit hit;

        if (NavMesh.SamplePosition(itemTarget.transform.position, out hit, 3f, NavMesh.AllAreas))
        {
            nAgent.SetDestination(hit.position);
        }


        Vector3 dir = hit.position - this.transform.position;

        if (dir.magnitude < .5f)
        {
            dState = DeathState.Flee;
        }
    }
        public IEnumerator Death()
        {
            switch (deathStation)
            {
            case DeathState.StartDeath:

                aplication.collider.enabled = false;

                transform.Translate(new Vector3(0.07f, 0.05f, 0));

                aplication._Body.bodyType = RigidbodyType2D.Static;

                yield return(new WaitForSeconds(0.5f));

                deathStation = DeathState.LoadPlayer;

                break;

            case DeathState.LoadPlayer:

                yield return(new WaitForSeconds(0.3f));

                deathStation = DeathState.StartDeath;

                aplication.collider.enabled = true;

                aplication._Body.bodyType = RigidbodyType2D.Dynamic;

                transform.position = new Vector2((float)ModuleDB.coordinateTable.CoordinateX, (float)ModuleDB.coordinateTable.CoordinateY);

                aplication.playerModel.Death = false;

                break;
            }
        }
Exemple #3
0
    public virtual void InitState()
    {
        {
            State state = new IdleState();
            state.Init(this);
            _stateMap[eStateType.IDLE] = state;
        }
        {
            State state = new MoveState();
            state.Init(this);
            _stateMap[eStateType.MOVE] = state;
        }
        {
            State state = new AttackState();
            state.Init(this);
            _stateMap[eStateType.ATTACK] = state;
        }
        {
            State state = new DamageState();
            state.Init(this);
            _stateMap[eStateType.DAMAGE] = state;
        }
        {
            State state = new DeathState();
            state.Init(this);
            _stateMap[eStateType.DEATH] = state;
        }

        _state = _stateMap[eStateType.IDLE];
    }
Exemple #4
0
        public override void SetDeathState(DeathState s)
        {
            base.SetDeathState(s);
            if (s != DeathState.JustDied || !IsGuardianPet())
            {
                return;
            }

            Unit owner = GetOwner();

            if (owner == null || !owner.IsPlayer() || owner.GetMinionGUID() != GetGUID())
            {
                return;
            }

            foreach (Unit controlled in owner.m_Controlled)
            {
                if (controlled.GetEntry() == GetEntry() && controlled.IsAlive())
                {
                    owner.SetMinionGUID(controlled.GetGUID());
                    owner.SetPetGUID(controlled.GetGUID());
                    owner.ToPlayer().CharmSpellInitialize();
                    break;
                }
            }
        }
Exemple #5
0
    private void Awake()
    {
        if (!alreadyLoaded)
        {
            instance = this;

            #region Instantiate State Machine & Level States

            gameSM              = new GameStateMachine();
            introState          = new GameIntroMenuState(this, gameSM);
            hangarState         = new HangarState(this, gameSM);
            asteroidLevelState  = new AsteroidLevelState(this, gameSM);
            nebulaLevelState    = new NebulaLevelState(this, gameSM);
            blackHoleLevelState = new BlackHoleLevelState(this, gameSM);
            deathState          = new DeathState(this, gameSM);
            highScoresState     = new HighScoresState(this, gameSM);

            #endregion

            #region Create Events

            SceneManager.sceneLoaded += OnSceneLoaded;
            AddEvents();

            #endregion
        }
    }
Exemple #6
0
    public void MakeFSM()
    {
        IdleState idle = new IdleState();

        idle.AddTransition(Transition.SawPlayer, StateID.AttackingState);
        idle.AddTransition(Transition.LostPlayer, StateID.MovingState);

        MoveState move = new MoveState();

        move.AddTransition(Transition.SawPlayer, StateID.AttackingState);

        AttackState attack = new AttackState();

        attack.AddTransition(Transition.LostPlayer, StateID.MovingState);
        attack.AddTransition(Transition.IdleTransition, StateID.IdleStateID);

        DefendState defend = new DefendState();

        EvadeState evade = new EvadeState();

        WinState win = new WinState();

        DeathState death = new DeathState();



        fsm = new FSMSystem();
        fsm.AddState(move);
        fsm.AddState(attack);
        fsm.AddState(idle);
        fsm.AddState(defend);
        fsm.AddState(evade);
        fsm.AddState(win);
        fsm.AddState(death);
    }
Exemple #7
0
        private void Start()
        {
            fsm          = new FiniteStateMachine("AITest FSM");
            IdleState    = fsm.AddState("IdleState");
            ScanState    = fsm.AddState("ScanState");
            PatrolState  = fsm.AddState("WanderState");
            PatrolAction = new WanderAction(PatrolState);
            IdleAction   = new IdleAction(IdleState);
            ScanAction   = new ScanningAction(ScanState);
            deathState   = fsm.AddState("DeathState");
            DeathAction  = new DeathState(deathState);
            //This adds the actions to the state and add state to it's transition map
            PatrolState.AddAction(PatrolAction);
            IdleState.AddAction(IdleAction);

            PatrolState.AddTransition("ToIdle", IdleState);
            IdleState.AddTransition("ToPatrol", PatrolState);
            ScanState.AddTransition("ToScanning", ScanState);
            deathState.AddTransition("ToDeath", deathState);
            PatrolAction.Init(target, 3.0f, gameObject.GetComponent <EnemyAstar>(), "ToIdle");
            IdleAction.Init(target, "AI on Idle", 3.0f, gameObject.GetComponent <EnemyAstar>(), "ToPatrol");
            DeathAction.Init(3.0f, gameObject.GetComponent <EnemyAstar>());
            ScanAction.Init(3.0f);
            fsm.StartMachine("IdleState");
        }
Exemple #8
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player") && dState == DeathState.Steal)
        {
            for (int i = 0; i < inventory.items.Count; i++)
            {
                if (itemTarget.name == inventory.items[i].name)
                {
                    Debug.Log("Steal item and stun!");

                    currentItem = inventory.items[i];
                    inventory.RemoveWhenUsed(inventory.items[i]);

                    currentItem.instance.transform.SetParent(deathHand);
                    currentItem.instance.transform.localPosition = Vector3.zero;
                    currentItem.instance.SetActive(true);

                    for (int n = 0; n < inventory.items.Count; n++)
                    {
                        inventory.RemoveFromInventory(inventory.items[n]);
                    }

                    PlayerControllerCC player = other.gameObject.GetComponent <PlayerControllerCC>();
                    if (player != null)
                    {
                        player.pState = PlayerControllerCC.PlayerState.Stunned;
                    }
                }
            }

            dState = DeathState.Flee;
        }
    }
Exemple #9
0
 public void SpawnPlayer()
 {
     currTimeToRevive  = 0;
     reviveTimeElapsed = 0;
     travelTimeElapsed = 0;
     if (reviveSlot != null)
     {
         reviveSlot.RemovePlayer();
         reviveSlot = null;
     }
     else
     {
         GameObject parent = SpawnDelegate.getInstance().getPlayerSpawnLocation(playerNum);
         gameObject.transform.SetParent(parent.transform, false);
         gameObject.transform.position = parent.transform.position;
     }
     playerRevivingMe = null;
     playerState      = PlayerState.SPAWNING;
     deathState       = DeathState.STARTING;
     if (rend == null)
     {
         rend = GetComponent <SpriteRenderer> ().GetComponent <Renderer> ();
     }
     ToggleBarrels(currentWeapon, true);
     rend.enabled = true;
     head.GetComponent <SpriteRenderer> ().enabled = true;
     initDone = true;
     StartCoroutine(Flash(SPAWNING_TIME, 0.05f));
 }
Exemple #10
0
    private void CmdDie()
    {
        //time transitions between states are handled in update
        DestroyBarrels();
        if (deathState == DeathState.STARTING)
        {
            Debug.Log("CmdDie starting");
            // Go unconscious for a few secs then explode
            deathStateTime = Time.time;
            deathState     = DeathState.UNCONSCIOUS;
            head.GetComponent <CircleCollider2D> ().enabled = false;
            nextWeaponIcon.enabled = false;

            foreach (ReviveSlot slot in reviveSlots)
            {
                slot.KillPlayer();
            }

            Shoot[] shooters = GetComponentsInChildren <Shoot> ();
            foreach (Shoot shooter in shooters)
            {
                shooter.enabled = false;
            }
        }
        else
        {
            Debug.LogError("CmdDie called while death was already happening.  Not an error, but get your shit together");
        }
    }
    private void InitStateMachine()
    {
        blackboard = new StateBlackboard();
        blackboard.Add <bool>(BlackboardKey.DamageFlag, false);
        blackboard.Add <bool>(BlackboardKey.RepeatDamageFlag, false);
        blackboard.Add <Transform>(BlackboardKey.Transform, transform);
        blackboard.Add <float>(BlackboardKey.AttackRange, 0f);

        EnemyIdleState idleState = EnemyIdleState.Create(blackboard, animator, "Idle", 0);
        StateNode      idleNode  = new StateNode(idleState, new Condition(() => { return(true); }));

        SetAnimTriggerAction walkAction       = new SetAnimTriggerAction(blackboard, animator, "Run");
        MeleeAttackState     meleeAttackState = MeleeAttackState.Create(blackboard, animator, navAgent, attackValidator.MeleeAttacks, transform, BlackboardKey.AttackRange, BlackboardKey.AnimTrigger, walkAction, 300);
        StateNode            attackNode       = new StateNode(meleeAttackState, new Condition(() => { return(target != null); }));

        DamageState damageState = DamageState.Create(blackboard, animator, "Damage", 500);
        StateNode   damageNode  = new StateNode(damageState, new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.DamageFlag)); }));

        DeathState deathState = DeathState.Create(blackboard, animator, "Death", int.MaxValue);
        StateNode  deathNode  = new StateNode(deathState, new Condition(() => { return(!self.IsAlive); }));

        List <StateNode> nodes = new List <StateNode>();

        nodes.Add(idleNode);
        nodes.Add(attackNode);
        nodes.Add(damageNode);
        nodes.Add(deathNode);

        stateMachine = new StateMachine(blackboard, nodes, idleState);
    }
Exemple #12
0
    protected override void Awake()
    {
        base.Awake();
        Initialize();

        HandleInitialze();

        var runningState   = new RunningState(this);
        var deathState     = new DeathState(this);
        var runAndGunState = new RunAndGunState(this);

        At(runningState, deathState, PlayerDead());
        At(runningState, runAndGunState, isEquipWeapon());
        At(runAndGunState, runningState, isWeaponDestroyed());
        At(runAndGunState, deathState, PlayerDead());

        _stateMachine.SetState(runningState);

        void At(IState from, IState to, Func <bool> condition) => _stateMachine.AddTransition(from, to, condition);

        //  Func<bool> StageStart() => () => true;
        Func <bool> PlayerDead() => () => _health.currentHealth <= 0;
        Func <bool> isEquipWeapon() => () => _characterHandleWeapon._weaponAttachments.isWeaponCreated;
        Func <bool> isWeaponDestroyed() => () => !_characterHandleWeapon._weaponAttachments.isWeaponCreated;
    }
Exemple #13
0
    private void Spawn()
    {
        EnableComponents();

        stuckTimer = 0f;

        spawnIndex = UnityEngine.Random.Range(1, spawnPoint.Length);

        if (currentItem != null)
        {
            for (int i = 0; i < trap.Length; i++)
            {
                if (currentItem.name == trap[i].targetItem.name)
                {
                    trapIndex = i;
                    nAgent.SetDestination(trap[trapIndex].interactionTransform.position);
                    dState = DeathState.Act;
                }
            }
        }
        else
        {
            nAgent.SetDestination(itemTarget.transform.position);
            dState = DeathState.Search;
        }
    }
Exemple #14
0
 private DeathState()
 {
     if (_instance != null)
     {
         return;
     }
     _instance = this;
 }
Exemple #15
0
 void Awake()
 {
     stateMachine = new StateMachine();
     attackState  = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; }, this, gameObject, stateMachine, "Attack");
     idleState    = new IdleState(IdleStateCond, () => StartCoroutine(WaitToLeaveIdle(idleTime)), () => {}, this, gameObject, stateMachine, "Idle");
     runState     = new RunState(FlyStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Fly");
     deathState   = new DeathState(DeathStateCond, () => { dead = true; GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.1f)); StartCoroutine(WaitToDie(6f)); }, () => {}, this, gameObject, stateMachine, "Death");
 }
Exemple #16
0
 public void Respawn()
 {
     if (deathState == DeathState.FINISHED || playerState == PlayerState.REVIVING)
     {
         deathState = DeathState.STARTING;
         initDone   = false;
         SpawnPlayer();
     }
 }
Exemple #17
0
    // Use this for initialization
    void Awake()
    {
        chaseState  = new ChaseState(this);
        patrolState = new PatrolState(this);
        attackState = new AttackState(this);
        deathState  = new DeathState(this);

        navMeshAgent = GetComponent <NavMeshAgent> ();
    }
Exemple #18
0
    private void InitStateMachine()
    {
        blackboard = new StateBlackboard();
        blackboard.Add(BlackboardKey.AttackingFlag, false);
        blackboard.Add(BlackboardKey.NextAttackFlag, false);
        blackboard.Add(BlackboardKey.SkillFlag, false);
        blackboard.Add(BlackboardKey.DamageFlag, false);
        blackboard.Add(BlackboardKey.RepeatDamageFlag, false);
        blackboard.Add(BlackboardKey.AnimTrigger, string.Empty);
        blackboard.Add <Transform>(BlackboardKey.Target, null);
        blackboard.Add <Vector3>(BlackboardKey.MoveDirection, Vector3.zero);

        SetAnimTriggerAction setIdleTriggerAction = new SetAnimTriggerAction(blackboard, animator, "Idle");
        LookAtTargetAction   lookAtAction         = new LookAtTargetAction(blackboard, transform);
        PlayerIdleState      idleState            = new PlayerIdleState(blackboard, setIdleTriggerAction, lookAtAction);
        StateNode            idleNode             = new StateNode(idleState, new Condition(() => { return(true); }));

        SetAnimTriggerAction   setRunTriggerAction  = new SetAnimTriggerAction(blackboard, animator, "Move");
        SetMoveDirectionAction setMoveDirAction     = new SetMoveDirectionAction(blackboard, transform, Camera.main.transform);
        MoveControllerAction   moveControllerAction = new MoveControllerAction(blackboard, GetComponent <CharacterController>(), runSpeed);

        PlayerMoveState moveState = new PlayerMoveState(blackboard, setRunTriggerAction, setMoveDirAction, moveControllerAction, 100);
        StateNode       moveNode  = new StateNode(moveState, new Condition(() => {
            float horizontal = inputController.GetRuntimeInputConfig().GetBinding(InputBindingName.GAMEPLAY_HORIZONTAL).Value;
            float vertical   = inputController.GetRuntimeInputConfig().GetBinding(InputBindingName.GAMEPLAY_VERTICAL).Value;
            return(Mathf.Abs(horizontal) > InputConstants.INPUT_DEAD_ZONE || Mathf.Abs(vertical) > InputConstants.INPUT_DEAD_ZONE);
        }));

        SetAnimTriggerAction setAttackTrigger     = new SetAnimTriggerAction(blackboard, animator, "Attack", true);
        SetAnimTriggerAction setNextAttackTrigger = new SetAnimTriggerAction(blackboard, animator, "NextAttack", true);
        PlayerAttackState    attackState          = new PlayerAttackState(blackboard, setAttackTrigger, setNextAttackTrigger, lookAtAction, 500);
        StateNode            attackNode           = new StateNode(attackState, new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.AttackingFlag) == true); }));

        SetAnimTriggerAction setSkillTrigger = new SetAnimTriggerAction(blackboard, animator, BlackboardKey.AnimTrigger, true);
        PlayerSkillState     skillState      = new PlayerSkillState(blackboard, setSkillTrigger, 400);
        StateNode            skillNode       = new StateNode(skillState, new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.SkillFlag) == true); }));

        SetAnimTriggerAction damageAction    = new SetAnimTriggerAction(blackboard, animator, "Damage", true);
        DamageState          damageState     = new DamageState(blackboard, damageAction, 600);
        Condition            damageCondition = new Condition(() => { return(blackboard.Get <bool>(BlackboardKey.DamageFlag)); });
        StateNode            damageNode      = new StateNode(damageState, damageCondition);

        DeathState deathState = DeathState.Create(blackboard, animator, "Die", int.MaxValue);
        StateNode  deathNode  = new StateNode(deathState, new Condition(() => { return(!self.IsAlive); }));

        List <StateNode> nodes = new List <StateNode>();

        nodes.Add(idleNode);
        nodes.Add(moveNode);
        nodes.Add(attackNode);
        nodes.Add(skillNode);
        nodes.Add(damageNode);
        nodes.Add(deathNode);

        stateMachine = new StateMachine(blackboard, nodes, idleState);
    }
Exemple #19
0
 public StateMachine(AgentBehaviour agent)
 {
     // Inicializo los estados
     _states       = new State[4];
     _states[0]    = new IdleState(agent);
     _states[1]    = new AttackState(agent);
     _states[2]    = new DeathState(agent);
     _states[3]    = new CelebrateState(agent);
     _currentState = 0;
 }
Exemple #20
0
    private void Act()
    {
        nAgent.SetDestination(trap[trapIndex].interactionTransform.position);

        Vector3 dir = trap[trapIndex].interactionTransform.position - this.transform.position;

        if (dir.magnitude < 1f)
        {
            dState = DeathState.Interact;
        }
    }
Exemple #21
0
    private void Flee()
    {
        nAgent.SetDestination(spawnPoint[spawnIndex].position);

        Vector3 dir = spawnPoint[spawnIndex].position - this.transform.position;

        if (dir.magnitude < 2)
        {
            dState = DeathState.Idle;
        }
    }
Exemple #22
0
    void SetState(DeathState state)
    {
        _state = state;
        switch (_state)
        {
        case DeathState.Start:
            StartCoroutine(LerpPoint(GameManager.Instance.Player.Score, Time.unscaledTime, 2f));

            CurrentLevelText.text = (GameManager.Instance.Player.CurrentLevelPlayer).ToString();
            Debug.Log("CurrentLevelText : " + CurrentLevelText.text);

            NextLevelText.text = (GameManager.Instance.Player.CurrentLevelPlayer + 1).ToString();
            Debug.Log("NextLevelText : " + NextLevelText.text);

            PlayerPrefs.SetInt("HighScore", GameManager.Instance.Player.HighScore);

            // Score saving
            _currentFilling = GameManager.Instance.Player.CurrentXp / GameManager.Instance.Player.NeededXp;
            GameManager.Instance.Player.CurrentXp += GameManager.Instance.Player.Score;
            _newFilling = GameManager.Instance.Player.CurrentXp / GameManager.Instance.Player.NeededXp;

            var _fillingRound = _newFilling;
            while (_fillingRound > 1f)
            {
                ++GameManager.Instance.Player.CurrentLevelPlayer;
                GameManager.Instance.Player.LoadDataFromFile();
                _fillingRound = GameManager.Instance.Player.CurrentXp / GameManager.Instance.Player.NeededXp;
                nextNeededXps.Add(GameManager.Instance.Player.NeededXp);
            }

            GameManager.Instance.Player.SaveData();
            SetState(DeathState.LerpBar);
            break;

        case DeathState.LerpBar:
            LerpBarNormal();
            break;

        case DeathState.LevelUp:
            NormalPanel.SetActive(false);
            LevelUpPanel.SetActive(true);

            break;

        case DeathState.NextBar:

            NormalPanel.SetActive(true);
            LevelUpPanel.SetActive(false);
            LerpBarLevelUp();
            break;
        }
    }
Exemple #23
0
    private void Steal()
    {
        ChangeState();

        stuckTimer += Time.deltaTime;
        if (stuckTimer > 30f)
        {
            stuckTimer = 0f;
            dState     = DeathState.Flee;
        }

        nAgent.SetDestination(playerTarget.position);
    }
Exemple #24
0
 protected virtual void Awake()
 {
     stateMachine = new StateMachine();
     attackState  = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; }, this, gameObject, stateMachine, "Attack");
     idleState    = new IdleState(IdleStateCond, () => StartCoroutine(WaitToLeaveIdle(idleTime)), () => {}, this, gameObject, stateMachine, "Idle");
     runState     = new RunState(RunStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Run");
     jumpState    = new JumpState(JumpStateCond, () => { if (velocity.y > 0)
                                                         {
                                                             jumping = true;
                                                         }
                                  }, () => jumping = false, this, gameObject, stateMachine, "Jump");
     deathState = new DeathState(DeathStateCond, () => { dead = true; GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.1f)); StartCoroutine(WaitToDie(6f)); }, () => {}, this, gameObject, stateMachine, "Death");
 }
Exemple #25
0
    protected override void Awake()
    {
        base.Awake();

        var idleState  = new IdleState();
        var deathState = new DeathState(this);

        At(idleState, deathState, IsCharacterDead());

        _stateMachine.SetState(idleState);

        void At(IState from, IState to, Func <bool> condition) => _stateMachine.AddTransition(from, to, condition);
        Func <bool> IsCharacterDead() => () => _health.currentHealth <= 0;
    }
Exemple #26
0
    private IEnumerator Interact()
    {
        transform.LookAt(trap[trapIndex].transform);

        if (onInteracting != null)
        {
            onInteracting.Invoke();
            onInteracting = null;
        }

        yield return(new WaitForSeconds(3));

        dState = DeathState.Flee;
    }
Exemple #27
0
 protected override void Awake()
 {
     stateMachine    = new StateMachine();
     attackState     = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; }, this, gameObject, stateMachine, "Attack");
     idleState       = new IdleState(IdleStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Idle");
     runState        = new RunState(RunStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Run");
     specialState    = new SpecialState(SpecialStateCond, OnEnterSpecialState, () => { coolDownSpecialTimer = 0f; cooldown = 0f; specialCond = false; canBeHit = true; coolDownTimer = 0f; }, this, gameObject, stateMachine, "Special");
     deathState      = new DeathState(DeathStateCond, () => { dead = true; GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.1f)); StartCoroutine(WaitToDie(6f)); }, () => {}, this, gameObject, stateMachine, "Death");
     playerTransform = GameObject.FindWithTag("Player").transform;
     healthBoss      = GameObject.Find("HealthBoss");
     health          = maxHealth;
     healthBoss.GetComponent <HealthBar>().SetMaxHealth(maxHealth);
     healthBoss.GetComponent <HealthBar>().SetHealth(health);
 }
    //Unity Functions
    private void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        anim  = GetComponent <Animator>();
        rb    = GetComponent <Rigidbody>();
        agent = GetComponent <NavMeshAgent>();

        walkState   = new WalkState(this);
        attackState = new AttackState(this);
        deathState  = new DeathState(this);

        outlineScript = GetComponentInChildren <Outline>();
    }
Exemple #29
0
    public override void _Ready()
    {
        _animatedSprite = GetNode <AnimatedSprite>("AnimatedSprite");
        _healthNode     = GetNode <HealthNode>("HealthNode");
        _reloadTimer    = GetNode <Timer>("ReloadTimer");

        StateMachine    = new StateMachine();
        _idleState      = new IdleState(this, StateMachine);
        _moveState      = new MoveState(this, StateMachine);
        _attackState    = new AttackState(this, StateMachine);
        _deathState     = new DeathState(this, StateMachine);
        _preAttackState = new PreAttackState(this, StateMachine);

        StateMachine.Initialize(_idleState);
    }
Exemple #30
0
    void Start()
    {
        IdleState     idle    = new IdleState(PlayerState.Idle, this);
        ReadyState    ready   = new ReadyState(PlayerState.Ready, this);
        FightingState fight   = new FightingState(PlayerState.Fighting, this);
        StopState     stop    = new StopState(PlayerState.Stop, this);
        SuccessState  success = new SuccessState(PlayerState.Success, this);
        DeathState    death   = new DeathState(PlayerState.Death, this);

        Machine = new StateMachine(idle);
        Machine.AddState(ready);
        Machine.AddState(fight);
        Machine.AddState(stop);
        Machine.AddState(success);
        Machine.AddState(death);
    }