I have a class GameServices which contains an instance of the class GameStates.
The class GameStates has a public enum called GameState and a static var named CurrentGameState.
My problems is, I can access CurrentGameState from the GameStates class, but not the GameState enum it self, while it is public.
The GameServices Class
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using SpaceGame.UI;
using SpaceGame.Content;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
namespace SpaceGame.Game
{
public class GameServices
{
public static ContentLoader ContentLoaderService;
public static UIHandler UIHandlerService;
public static GameStates GameStatesService;
public static void Initialize(ContentManager contentManager, GraphicsDevice graphicsDevice)
{
ContentLoaderService = new ContentLoader(contentManager);
UIHandlerService = new UIHandler(graphicsDevice);
GameStatesService = new GameStates();
}
}
}
The GameStates Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SpaceGame.Game
{
public class GameStates
{
public GameState CurrentGameState { get; set; }
public enum GameState
{
Settings,
Splash,
SpaceShipyard
}
public GameStates()
{
CurrentGameState = GameState.Splash;
}
}
}
Am I doing something wrong?
Thanks in Advance,
Mark
IF you’re trying to access it from the same namespace, you’ll have to do something like
If you’re doing that, but it’s not working than I can’t help you at this point.
Here’s a sample that i did. It compiles for me.