public void UpdateState() { // if the current state exists, // update it if (currState != null) { currState.Update(); } }
protected override void Update() { float targetVelocityX = direction.x * moveSpeed; currentState.Update(this, ref velocity); velocity.y += gravity * Time.deltaTime; controller.Move(velocity * Time.deltaTime, false); if (controller.collisionInfo.above || controller.collisionInfo.below) { velocity.y = 0; } FlipSpriteDirection(); }