/*
* Hackerhavoc.cs
* Authors: Brian Chesbrough
*
* Copyright Matthew Belmonte 2007
*/
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Pina3D;
using Pina3D.Particles;
using tAC_Engine;
using Astropolis;
namespace Game.Astropolis.HackerHavoc
{
class HackerHavoc : MiniGame
{
///
/// Hacker Havoc
///
//variables
private enum GameState { Menu, Tutorial, NavagationMode, HackerMode, Paused }
private enum GameTurn { playerTurn, friendlyTurn, enemyTurn }
private GameState mGameState; // The state of the minigame
private GameWorld mGameWorld; // Defines a basic 3D coordinate system, game entities
private Random mRandom = new Random(); // Basic random number generator
private Entity mMenuBackground; // The background image for the main menu
private Button mStartButton; // For the main menu
private Button mTutorialButton; // ''
private Button mBackButton; // ''
private Button mPassTurnButton; // Button to pass turn in navagation phase
// private float mPlayerMeterMax; // What the players movement meter is set to when its full
///
/// Constructor
///
public HackerHavoc()
{
// Basic game initialization
HUD.ShowMouseCursor = true;
//Logger.LogCode(Logger.ExperimentalCode.HH_GameBegin);
LuaHelper.RegisterLuaCallbacks(this);
// Get the phase queue from the config file
//mPhaseQueue = new MeteorPhaseQueue(GenericBaseApplication.GameManager.GetPhaseQueueForMiniGame("MeteorMadness"));
mGameState = GameState.Menu;
// Initialize game params
mGameWorld = new GameWorld(GenericBaseApplication.GameManager.GraphicsDevice.Viewport);
//temp MM menu declaration
mMenuBackground = new Entity(TextureManager.Load(@"Content\MiniGames\HHSplashLogo"));
mStartButton = new Button(
TextureManager.Load(@"Content\MiniGames\MMStartButton"),
TextureManager.Load(@"Content\MiniGames\MMStartButtonOn"));
mTutorialButton = new Button(
TextureManager.Load(@"Content\MiniGames\MMTutorialButton"),
TextureManager.Load(@"Content\MiniGames\MMTutorialButtonOn"));
mBackButton = new Button(
TextureManager.Load(@"Content\MiniGames\MMBackButton"),
TextureManager.Load(@"Content\MiniGames\MMBackButtonOn"));
int screenWidth = GenericBaseApplication.GameManager.ScreenWidth;
int screenHeight = GenericBaseApplication.GameManager.ScreenHeight;
mMenuBackground.Size = new Vector3(screenWidth, screenHeight, 0);
mMenuBackground.Position = new Vector3(screenWidth / 2, screenHeight / 2, 0);
mStartButton.Size = new Vector3(screenWidth * .22f, screenHeight * .09f, 0f);
mTutorialButton.Size = mStartButton.Size;
mBackButton.Size = mStartButton.Size;
mStartButton.Position = new Vector3(screenWidth * .12f, screenHeight * .935f, 0f);
mTutorialButton.Position = mStartButton.Position + new Vector3(screenWidth * .24f, 0f, 0f);
mBackButton.Position = mTutorialButton.Position + new Vector3(screenWidth * .24f, 0f, 0f);
mPassTurnButton = new Button(TextureManager.Load(@"Content\MiniGames\HHPassTurnButton"));
mPassTurnButton.Position = new Vector3((mPassTurnButton.Position.X + mPassTurnButton.Size.X / 2), (mPassTurnButton.Position.Y + mPassTurnButton.Size.Y / 2), 0f);
//create planets, wormholes, merchants and then raiders
}
///
/// Perform necessary logic updates
///
///
public override void Update()
{
float dt = AstroBaseApplication.GameManager.ElapsedSeconds;
if (mGameState == GameState.Menu)
{
//SoundManager.SetMusic("Maritime Defender Theme");
HUD.ShowMouseCursor = true;
mStartButton.Update();
mTutorialButton.Update();
mBackButton.Update();
if (mStartButton.IsLeftClicked || (InputState.IsKeyDown(Keys.Enter) && !InputState.WasKeyDown(Keys.Enter)))
{
//Start the game up
mGameState = GameState.NavagationMode;
}
}
if (mGameState == GameState.NavagationMode)
{
mGameWorld.Update();
}
}
///
/// Draws all objects registered with the gameboard
///
public override void Draw()
{
if (mGameState == GameState.Menu)
{
SpriteBatch sb = new SpriteBatch(GenericBaseApplication.GameManager.GraphicsDevice);
sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
// Render the main menu
mMenuBackground.Draw(sb);
mStartButton.Draw(sb);
mTutorialButton.Draw(sb);
mBackButton.Draw(sb);
sb.End();
}
else if (mGameState == GameState.NavagationMode)
{
// Render the objects registered in the gameboard
mGameWorld.Render();
//temp pass turn button rednering
// SpriteBatch sb = new SpriteBatch(GenericBaseApplication.GameManager.GraphicsDevice);
// sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
// Render the pass turn button
// mPassTurnButton.Draw(sb);
// sb.End();
}
}
}
}