/// <summary> /// Constructor loading values from a specified file /// </summary> /// <param name="filename">Specified file with equipment information</param> EquipmentDatabase(string filename) { // Load the debugger EquipDebug = new Debugger("EquipDebug", debugOn); // First, check to see if the filename has the right format if (!filename.Contains(".dat")) { EquipDebug.debugPrint("[EquipmentDatabase ERROR]: Filename doesn't end in .dat"); return; } // Checks to make sure the file is there if (!File.Exists(filename)) { string msg = "[EquipmentDatabase ERROR]: File " + filename + " doesn't exist"; EquipDebug.debugPrint(msg); return; } // Opens the file in binary BinaryReader bReader = new BinaryReader(File.OpenRead(filename)); // TODO: Load values from the file }
/// <summary> /// Constructor for the battle engine. /// </summary> private BattleEngine(PartyClass playerParty, PartyClass enemyParty) { // If either are null, exit this class if (playerParty == null || enemyParty == null) { BattleDebug.debugPrint("PlayerParty or EnemyParty is null! Not initializing..."); return; } // If the party sizes aren't correct, also exit if (playerParty.Count <= 0 || enemyParty.Count <= 0) { BattleDebug.debugPrint("PlayerParty or EnemyParty do not have any combatants!"); return; } this.playerParty = playerParty; this.enemyParty = enemyParty; // Set all times to 0 // NOTE: Time should be set based on how much speed a character has playerParty.Initialize(true); enemyParty.Initialize(true); // Set the character triggers to respond playerParty.Ready += ReadyHandler; enemyParty.Ready += EnemyReadyHandler; // Flag that the battle is going on and the timer should update for (int i = 0; i < playerParty.Count; i++) { playerParty.Party[i].BattleGoing = true; } for (int i = 0; i < enemyParty.Count; i++) { enemyParty.Party[i].BattleGoing = true; } // Initialize debug controls and variables debugOn = true; battleDebug = new Debugger("BattleDebug", debugOn); // Signal that the engine has initialized OnInitialized(); }
/// <summary> /// Constructor loads and initializes the class /// </summary> /// <param name="graphicsComponent">Place where to render the graphics to</param> /// <param name="contentManager">Content to load from</param> private MapEngine(GraphicsDevice graphicsComponent, ContentManager contentManager) { if (graphicsComponent == null) { throw new ArgumentNullException("graphicsComponent"); } graphics = graphicsComponent; contents = contentManager; spriteBatch = new SpriteBatch(graphics); // Load the blank texture blankTexture = contents.Load<Texture2D>("blank"); // Initialize debug controls and variables debugOn = true; mapDebug = new Debugger("MapDebug", debugOn); showLayer = new bool[3]; // Set to show all layers for (int i = 0; i < 3; i++) showLayer[i] = true; // Initialize the cinematic fades fadeColor[0] = 255; fadeColor[1] = 0; // DEBUG: Used to control the camera manually controlCamera = false; }