Last active
August 29, 2015 14:27
-
-
Save goshdarngames/617aceea1eb0d9fa5e77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************************************************** | |
* GameData.cs | |
* | |
* Holds pointers to data that may be needed by more than one gameplay | |
* state. | |
****************************************************************************/ | |
using UnityEngine; | |
using System.Collections; | |
namespace BogeyGreen | |
{ | |
public class GameData | |
{ | |
public GameObject currentLevel; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************************************************************** | |
* GameManager.cs | |
* | |
* Stores data that may be needed by multiple parts of the system. | |
* | |
* Uses a state machine to control the logic of the game. | |
* | |
****************************************************************************/ | |
using UnityEngine; | |
using System.Collections; | |
using FiniteStateMachine; | |
namespace BogeyGreen | |
{ | |
public class GameManager : MonoBehaviour | |
{ | |
/********************************************************************* | |
* PRIVATE DATA | |
********************************************************************/ | |
private StateMachine gameFSM; | |
private GameData gameData; | |
/********************************************************************* | |
* START | |
********************************************************************/ | |
void Start() | |
{ | |
this.gameData = new GameData (); | |
SinglePlayerGameplayState singlePlayerState = | |
new SinglePlayerGameplayState (this.gameData); | |
this.gameFSM = new StateMachine (singlePlayerState); | |
} | |
/********************************************************************* | |
* UPDATE | |
********************************************************************/ | |
void Update() | |
{ | |
this.gameFSM.update (); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment