static void Main() { Player Knight = new Player("Knight", 100f, 1, 50f, 7f); Player Viking = new Player("Viking", 150f, 1, 75f, 5f); Player Samuri = new Player("Samuri", 90f, 1, 40f, 12f); Enemy e1 = new Enemy("e1", 70f, 1, 25f, 9f); Enemy e2 = new Enemy("e2", 100f, 1, 35f, 5f); Enemy e3 = new Enemy("e3", 65f, 1, 20f, 12f); Combat.Instance.AddPlayer(Knight); Combat.Instance.AddPlayer(Viking); Combat.Instance.AddPlayer(Samuri); Combat.Instance.AddPlayer(e1); Combat.Instance.AddPlayer(e2); Combat.Instance.AddPlayer(e3); FSM <GameState> fsm = new FSM <GameState>(); fsm.AddTransition(GameState.init, GameState.running); fsm.GetState(GameState.init).AddEnterFunction((Action) delegate { Debug.WriteLine("init state"); }); fsm.GetState(GameState.running).AddEnterFunction((Action) delegate { Debug.WriteLine("running state"); }); fsm.Start(GameState.init); fsm.ChangeState(GameState.running); Combat.Instance.SortEntities(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static void Main() { //State TurnBegin = new State(TurnState.TurnBegin); //State TurnEnd = new State(TurnState.TurnEnd); //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); //FSM<Enum> fsm = new FSM<Enum>(); //fsm.AddTransition(GameStart, TurnBegin); //fsm.AddTransition(TurnBegin, PlayerTurn); //fsm.AddTransition(PlayerTurn, TurnEnd); //fsm.AddTransition(TurnEnd, TurnBegin); //fsm.AddTransition(TurnEnd, GameEnd); //fsm.AddTransition(TurnBegin, GameEnd); //fsm.AddTransition(PlayerTurn, GameEnd); //fsm.GetState(TurnState.TurnBegin).AddEnterFunction((Handler)StateBehavior.TurnBeginBehavior); //fsm.GetState(TurnState.PlayerTurn).AddEnterFunction((Handler)StateBehavior.PlayerTurnBehavior); //fsm.GetState(TurnState.TurnEnd).AddEnterFunction((Handler)StateBehavior.TurnEndBehavior); FSM <TestState> Test = new FSM <TestState>(); Test.AddTransition(TestState.init.ToString(), Test.GetState(TestState.idle)); Test.AddTransition(TestState.idle.ToString(), Test.GetState(TestState.exit)); Test.ChangeState(Test.GetState(TestState.exit)); Test.ChangeState(Test.GetState(TestState.idle)); Test.ChangeState(Test.GetState(TestState.init)); Test.ChangeState(Test.GetState(TestState.exit)); }