public Movement(Player player, MovementAttr stats) : base(player) { this.attr = stats; rayCastController = player.RayCastController; props = new MovementProps( ); basicMove = new BasicMoveStrategy(ref props, ref stats, player); spaceMove = new SpaceMoveStrategy(ref props, ref stats, player); slideMove = new SlideMoveStrategy(ref props, ref stats, player); strategy = basicMove; props.originGravity = player.Rb.gravityScale; }
void OnSlideAreaEnter(OnSlideAreaEnter e) { if (e.IsEnter) { strategy = slideMove; strategy.Init( ); } else if (strategy == slideMove) { strategy = basicMove; strategy.Init( ); } }
void OnSpaceAreaEnter(OnSpaceAreaEnter e) { if (e.IsEnter) { strategy = spaceMove; strategy.Init( ); Player.Anim.SetBool("space", true); } else if (strategy == spaceMove) { strategy = basicMove; strategy.Init( ); Player.Anim.SetBool("space", false); } }