void Awake() { if (mcp == null) { mcp = GameObject.FindGameObjectWithTag("MCP").GetComponent <MasterControlProgram>(); } }
public void DamageEnemy(int damage) { stats.curHealth -= damage; if (stats.curHealth <= 0) { MasterControlProgram.KillEnemy(this); } if (statusIndicator != null) { statusIndicator.SetHealth(stats.curHealth, stats.maxHealth); } }
public void RenderMenu() { ConsoleColor f = ConsoleColor.Gray; ConsoleColor b = ConsoleColor.Black; char[] label; string content; ConsoleMenuController temp = (ConsoleMenuController)MasterControlProgram.GetController(); for (int i = 0; i < uiContent.GetLength(0); i++) { for (int j = 0; j < uiContent.GetLength(1); j++) { uiContent[i, j] = new ConsolePixel(); } } content = "CONSOLE DUNGEON CRAWLER : MAIN MENU"; label = content.ToCharArray(); for (int i = 0; i < label.Length; i++) { f = ConsoleColor.Green; uiContent[0, i] = new ConsolePixel(label[i], f); } if (temp.states.Count > 0) { for (int i = 0; i < temp.states.Count; i++) { content = temp.states[i].ToString(); label = content.ToCharArray(); for (int j = 0; j < label.Length; j++) { if (i == temp.index) { f = ConsoleColor.Gray; b = ConsoleColor.Magenta; } else { f = ConsoleColor.Gray; b = ConsoleColor.Black; } uiContent[1 + i, j] = new ConsolePixel(label[j], f, b); } } } }
static void Main(string[] args) { MasterControlProgram MCP = new MasterControlProgram(); ConsoleMenuController menuController = new ConsoleMenuController(); ConsolePlayerController playerController = new ConsolePlayerController(); ConsoleView view = new ConsoleView(); //Console.SetWindowSize(236, 80); Console.SetWindowSize(60, 60); MasterControlProgram.SetController(menuController); MCP.view = view; MCP.Run(); return; }
public void Execute() { int current = data.currentItem; ConsoleKey input = Console.ReadKey().Key; switch (input) { case ConsoleKey.W: //Console.WriteLine("\nw"); if (current <= 0) { current = data.inventory.content.Count() - 1; } else { current = current - 1; } break; case ConsoleKey.S: //Console.WriteLine("\ns"); if (current >= data.inventory.content.Count() - 1) { current = 0; } else { current = current + 1; } break; case ConsoleKey.Enter: //Console.WriteLine("\nenter"); UseItem(); break; case ConsoleKey.I: //Console.WriteLine("\ni"); MasterControlProgram.SetController(new ConsolePlayerController()); current = -1; data.inv = !data.inv; break; } data.currentItem = current; }
public void DamagePlayer(int damage) { stats.curHealth -= damage; if (stats.curHealth <= 0) { //play deth sound audioManager.PlaySound(dethSoundName); //kill player MasterControlProgram.KillPlayer(this); } else { //play damage sound audioManager.PlaySound(damageSoundName); } statusIndicator.SetHealth(stats.curHealth, stats.maxHealth); }
public void Enter(GameStates state) { this.state = state; if (state == GameStates.GAME) { MasterControlProgram.SetController(new ConsolePlayerController()); } if (state == GameStates.MENU) { MasterControlProgram.SetController(new ConsoleMenuController()); } if (state == GameStates.MAPS) { MasterControlProgram.SetController(new ConsoleMapSelectionController()); } if (state == GameStates.FINISH) { MasterControlProgram.SetController(null); } }
public void QuitInventory() { MasterControlProgram.SetController(new ConsolePlayerController()); data.currentItem = -1; data.inv = !data.inv; }
private void InventorySwitch() { MasterControlProgram.SetController(new ConsoleInventoryController()); data.inv = !data.inv; data.currentItem = 0; }