/*
* AstroBaseApplication.cs
* Authors: August Zinsser
*
* Copyright Matthew Belmonte 2007
*/
using System;
using System.Collections.Generic;
using System.Text;
using tAC_Engine;
using Astropolis.ColonySimulator;
using Game.Astropolis.HackerHavoc;
namespace Astropolis
{
///
/// Provides a channel for communication between the colony simulator, the mini games, and the actual game engine.
/// This class accomplishes that by serving as the parent to the maingame, colonygame, minigames, and control panel.
///
public class AstroBaseApplication : GenericBaseApplication
{
public static MiniGame MiniGame;
public enum Modes { StartUp, ShutDown, ModeSelector, Colony, MeteorMadness, HackerHavoc };
private static Modes currentMode;
///
/// The omnipresent portion of the Colony Simulator
///
public static ColonyGame Game
{
set
{
System.Diagnostics.Debug.Assert(value is ColonyGame);
mGame = value;
}
get
{
System.Diagnostics.Debug.Assert(mGame is ColonyGame);
return (ColonyGame)mGame;
}
}
///
/// Stores global data, oversees program flow and activates the appropriate game mode
///
new public static AstroGameManager GameManager
{
set
{
System.Diagnostics.Debug.Assert(value is AstroGameManager);
mGameManager = value;
}
get
{
System.Diagnostics.Debug.Assert(mGameManager is AstroGameManager);
return (AstroGameManager)mGameManager;
}
}
///
/// Performs necessary loading/unloading when switching between game modes
///
///
public static void SwitchMode(Modes newMode)
{
currentMode = newMode;
if (newMode == Modes.StartUp)
{
MiniGame = new StartUp();
}
else if (newMode == Modes.ShutDown)
{
MiniGame = new ShutDown();
}
else if (newMode == Modes.ModeSelector)
{
MiniGame = new ModeSelector();
}
else if (newMode == Modes.MeteorMadness)
{
MiniGame = new MeteorMadness();
}
else if (newMode == Modes.HackerHavoc)
{
MiniGame = new HackerHavoc();
}
else
{
// also occurs if (newMode == Modes.ColonySim)
// Going back to the colony simulator, so unload the current minigame
if (newMode != Modes.Colony)
{
// This should never happen
System.Diagnostics.Debug.Assert(false, "Error in program flow");
}
MiniGame = null;
Game.Initialize();
return;
}
}
}
}