Hey guys,
I’m trying to create a global script to manage game states, but even if i set a specific gamestate it wont change for some reason.
This is the gamestate script:
using UnityEngine;
using System.Collections;
public static class GameState {
public enum States {Running, Died , Pause , Won}
public static States state = States.Pause;
public static bool Running {
get {
switch(state){
case States.Running:
return true;
}
return false;
}
set {
if(value == true)
state = States.Running;
}
}
public static bool Died {
get {
switch(state){
case States.Died:
return true;
}
return false;
}
set {
if(value == true)
state = States.Died;
}
}
public static bool Pause {
get {
switch(state){
case States.Pause:
return true;
}
return false;
}
set {
if(value == true)
state = States.Pause;
}
}
public static bool Won {
get {
switch(state){
case States.Won:
return true;
}
return false;
}
set {
if(value == true)
state = States.Won;
}
}
}
The script is not instanced, and i want to keep it that way. You guys have any idea on how to make this script work globally by calling something like GameState.Pause ?