void Start() { // Vida atual recebe o maximo de vida possivel currentLife = maxLife; // Esta vivo isAlive = true; stateMachine = new SKMecanimStateMachine<GirlController>(animatorController.CachedAnimator, this, new Girl_IdleState()); //Todos os estados da menina sao adicionados na maquina de estado stateMachine.addState(new Girl_IdleState()); stateMachine.addState(new Girl_RunState()); stateMachine.addState(new Girl_JumpState()); stateMachine.addState(new Girl_OnAirState()); stateMachine.addState(new Girl_AttackOnAirState()); stateMachine.addState(new Girl_AttackState()); stateMachine.addState(new Girl_AttackOnRunState()); stateMachine.addState(new Girl_WallJumpState()); stateMachine.addState(new Girl_OnDeathState()); // Quando passa de um estado para outro, imprime na tela este estado /*stateMachine.onStateChanged += () => { Debug.Log(stateMachine.currentState.ToString()); };*/ }
void Start() { var animator = GetComponent <Animator>(); // create the state machine _stateMachine = new SKMecanimStateMachine <MecanimPlayerController>(animator, this, new RunStraightState()); // add all of our states so that we can switch to them at will _stateMachine.addState(new RunLeftState()); _stateMachine.addState(new RunRightState()); // listen for state changes and log them _stateMachine.onStateChanged += () => { Debug.Log("state changed: " + _stateMachine.currentState); }; }
void Start() { var animator = GetComponent<Animator>(); // create the state machine _stateMachine = new SKMecanimStateMachine<MecanimPlayerController>( animator, this, new RunStraightState() ); // add all of our states so that we can switch to them at will _stateMachine.addState( new RunLeftState() ); _stateMachine.addState( new RunRightState() ); // listen for state changes and log them _stateMachine.onStateChanged += () => { Debug.Log( "state changed: " + _stateMachine.currentState ); }; }
// Use this for initialization void Start() { currentLife = maxLife; isAlive = true; pandaStateMachine = new SKMecanimStateMachine<PandaController>(animatorController.CachedAnimator, this, new Panda_IdleState()); pandaStateMachine.addState(new Panda_IdleState()); pandaStateMachine.addState(new Panda_RunState()); pandaStateMachine.addState(new Panda_JumpState()); pandaStateMachine.addState(new Panda_OnAirState()); pandaStateMachine.addState(new Panda_WallJumpState()); pandaStateMachine.addState(new Panda_AttackOnIdleState()); pandaStateMachine.addState(new Panda_AttackOnRunState()); pandaStateMachine.addState(new Panda_AttackOnAirState()); pandaStateMachine.addState(new Panda_OnDeathState()); pandaStateMachine.onStateChanged += () => { // Debug.Log(pandaStateMachine.currentState.ToString()); }; }
// Use this for initialization void Start() { currentLife = maxLife; isAlive = true; archerStateMachine = new SKMecanimStateMachine<ArcherController>(animatorController.CachedAnimator, this, new Archer_IdleState()); archerStateMachine.addState(new Archer_IdleState()); archerStateMachine.addState(new Archer_RunState()); archerStateMachine.addState(new Archer_JumpState()); archerStateMachine.addState(new Archer_OnAirState()); archerStateMachine.addState(new Archer_WallJumpState()); archerStateMachine.addState(new Archer_AttackOnIdleState()); archerStateMachine.addState(new Archer_AttackOnRunState()); archerStateMachine.addState(new Archer_AttackOnAirState()); archerStateMachine.addState(new Archer_OnDeathState()); /* archerStateMachine.onStateChanged += () => { Debug.Log(archerStateMachine.currentState.ToString()); }; */ }
internal void SetMachineAndContext(SKMecanimStateMachine <T> machine, T context) { _machine = machine; _context = context; OnInitialized(); }