Skip to content

Instantly share code, notes, and snippets.

@goshdarngames
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goshdarngames/617aceea1eb0d9fa5e77 to your computer and use it in GitHub Desktop.
Save goshdarngames/617aceea1eb0d9fa5e77 to your computer and use it in GitHub Desktop.
/*****************************************************************************
* 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;
}
}
/*****************************************************************************
* 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