Пример #1
0
        public void SelectStrategy(string strategy)
        {
            string socketId = Context.ConnectionId;

            switch (strategy)
            {
            case "Laser":
                StrategyHolder.ChangeActiveStrategy(socketId, new LaserAttack());
                break;

            case "Bomb":
                StrategyHolder.ChangeActiveStrategy(socketId, new BombAttack());
                break;

            case "Cross":
                StrategyHolder.ChangeActiveStrategy(socketId, new CrossAttack());
                break;

            //default case always sets strategy to Basic Attack
            default:
                StrategyHolder.ChangeActiveStrategy(socketId, new BasicAttack());
                break;
            }
        }