コード例 #1
0
 public override sealed void Sprint()
 {
     if (((GetCurrentPosition().X > 100 && GetCurrentPosition().Y < 150 && moveStrategy.GetType() == typeof(Player1Movement)) ||
          (GetCurrentPosition().X > 750 && GetCurrentPosition().Y < 150 && moveStrategy.GetType() == typeof(Player2Movement))) &&
         (this.GetType() == typeof(PowerfulBaloon) || this.GetType() == typeof(IntermediateBaloon)))
     {
         ChangeToSprintSpeed();
     }
     else
     {
         BackToDefaultSpeed();
     }
 }
コード例 #2
0
        public void SetMoveStrategy(IMoveAlgorithm strategy)
        {
            var oldStrategy = MoveStrategy == null ? "Nothing" : MoveStrategy.GetType().Name;
            var newStrategy = strategy == null ? "Nothing" : strategy.GetType().Name;

            Console.WriteLine("Switching move strategy from {0} to {1}", oldStrategy, newStrategy);
            MoveStrategy = strategy;
        }