text: import State from "./../../../../helpers/objects/state.js"
  
  import AttackState from "./attack.js"
  import MoveState from "./move.js"
  
  class IdleState extends State {
  
    constructor(scene, actor) {
      super(scene, actor);
  
    }
  
    // Inner logic
    handle(input) {
      if (this.actor.jump.timer && this.actor.jump.timer < this.scene.time.now)
        this.actor.fsm.change("jump");
  
      if (!this.actor.body.onFloor()) this.actor.fsm.change("fall");
  
      if (input.attack.isDown && this.actor.can.attack) AttackState.strike(this.actor);
  
      if ((input.left.isDown || input.right.isDown)) {
        this.actor.animator.play(this.actor, "move");
  
        var moving = null;
  
        if (input.right.isDown) {
          moving = true;
        } else moving = false;
  
        MoveState.sway(this.scene, this.actor.getData("speed"), moving, false, this.actor);
      } else this.actor.animator.play(this.actor, "idle");
  
      ["jump", "interact"].forEach((state, i) => {
        if (input[state].isDown && this.actor.can[state]) {
          this.actor.fsm.change(state);
        }
      });
    }
  }
  
  export default IdleState;
  