public void Run() { var kingName = Console.ReadLine(); var king = new King(kingName); this.repository.AssignKing(king); var royalGuardNames = Console.ReadLine().Split(); foreach (var name in royalGuardNames) { var guard = GuardFactory.CreateGuard("RoyalGuard", name, king); this.repository.AddGuard(guard); } var footmenNames = Console.ReadLine().Split(); foreach (var name in footmenNames) { var guard = GuardFactory.CreateGuard("Footman", name, king); this.repository.AddGuard(guard); } while (true) { var input = Console.ReadLine(); if (input == "End") { break; } var commandParams = input.Split(); this.executor.Execute(commandParams, this.repository); } }
private bool game_over = false; //游戏结束 void Awake() { SSDirector director = SSDirector.GetInstance(); director.CurrentScenceController = this; guard_factory = Singleton <GuardFactory> .Instance; action_manager = gameObject.AddComponent <GuardActionManager>() as GuardActionManager; gui = gameObject.AddComponent <UserGUI>() as UserGUI; LoadResources(); recorder = Singleton <ScoreRecorder> .Instance; }
public Factory( DiContainer diContainer, GuardFactory guardFactory, SearchTrackManager.Factory searchTrackManagerFactory ) { _diContainer = diContainer; _guardFactory = guardFactory; _searchTrackManagerFactory = searchTrackManagerFactory; }
public Level(GameLoop game, ArrayList _textures, ArrayList _fonts, ArrayList _sounds, MusicManager _musicPlayer, PlotScreen _plotScreen, LevelLoader loader, InputHandler _inputHandler) : base(game) { int screenWidth = Game.GraphicsDevice.Viewport.Width; int screenHeight = Game.GraphicsDevice.Viewport.Height; bolts = new List<Bolt>(); torches = new List<Torch>(); guards = new List<IGuard>(); levers = new List<Lever>(); gates = new List<Gate>(); boxBolts = new List<BoxOfBolts>(); buttons = new List<Button>(); spouts = new List<Spout>(); playerRange = new Rectangle((screenWidth * 2) / 5, 0, screenWidth / 5, screenHeight); levelLoader = loader; textures = _textures; sounds = _sounds; fonts = _fonts; musicPlayer = _musicPlayer; plotScreen = _plotScreen; guardFactory = new GuardFactory((Texture2D)textures[wizardIndex], (Texture2D)textures[soldierIndex], (Texture2D)textures[LOSIndex]); currentLevel = 0; deathCounter = 0; screenWidth = Game.GraphicsDevice.Viewport.Width; screenHeight = Game.GraphicsDevice.Viewport.Height; this.game = game; inputHandler = _inputHandler; levelLoader.LoadLevel(currentLevel); }