void initSM() { State state_halt = new State(); State state_follow = new State(); State state_seek = new State(); State state_attack = new State(); State state_die = new State(); Transition halt2seek = new Transition(); Transition halt2follow = new Transition(); Transition seek2attack = new Transition(); Transition attack2die = new Transition(); Transition halt2die = new Transition(); Transition halt2attack = new Transition(); Transition attack2seek = new Transition(); Transition follow2seek = new Transition(); halt2seek.Trigger_condition = new TriggerCondition(transitionInSeekRange); seek2attack.Trigger_condition = new TriggerCondition(transitionInAttackRange); halt2attack.Trigger_condition = new TriggerCondition(transitionInAttackRange); halt2die.Trigger_condition = new TriggerCondition(transitionDie); attack2die.Trigger_condition = new TriggerCondition(transitionDie); attack2seek.Trigger_condition = new TriggerCondition(transitionOutAttackRange); halt2follow.Trigger_condition = new TriggerCondition(transitionInFollowRange); follow2seek.Trigger_condition = new TriggerCondition(transitionInSeekRange); halt2seek.Target_state = state_seek; seek2attack.Target_state = state_attack; halt2die.Target_state = state_die; halt2attack.Target_state = state_attack; attack2die.Target_state = state_die; attack2seek.Target_state = state_seek; halt2follow.Target_state = state_follow; follow2seek.Target_state = state_seek; halt2attack.Transition_Action = new Action(actionTransitionAttack); seek2attack.Transition_Action = new Action(actionTransitionAttack); halt2seek.Transition_Action = new Action(actionTransitionSeek); halt2follow.Transition_Action = new Action(actionFollowRunning); state_halt.addTransition(halt2die); state_halt.addTransition(halt2seek); state_halt.addTransition(halt2attack); state_seek.addTransition(seek2attack); state_attack.addTransition(attack2die); state_attack.addTransition(attack2seek); state_halt.addTransition(halt2follow); state_follow.addTransition(follow2seek); state_halt.addAction(new Action(actionHaltRunning)); state_seek.addAction(new Action(actionSeekRunning)); state_attack.addAction(new Action(actionAttackRunning)); state_die.addAction(new Action(actionDieRunning)); state_follow.addAction(new Action(actionFollowRunning)); simple_ai = new Statemachine(state_halt); }
void Start() { statemachine = new Statemachine(); statemachine.ChangeState(new Room0State()); statemachine.ExecuteStateUpdate(); deathCountdown = FindObjectOfType <DeathCountdown>(); robotSoundManager = FindObjectOfType <RobotSoundManager>(); }
void initSM() { state_player = new State(); state_animation = new State(); state_enemy = new State(); state_start = new State(); Transition player2animation = new Transition(); Transition animation2enemy = new Transition(); Transition enemy2animation = new Transition(); Transition animation2player = new Transition(); Transition start2player = new Transition(); player2animation.Trigger_condition = new TriggerCondition(conditionValidInput); animation2enemy.Trigger_condition = new TriggerCondition(conditionFinishedPlayerAnimation); enemy2animation.Trigger_condition = new TriggerCondition(conditionDeterminedActions); animation2player.Trigger_condition = new TriggerCondition(conditionFinishedEnemyAnimation); start2player.Trigger_condition = new TriggerCondition(conditionPlacedBase); player2animation.Target_state = state_animation; animation2enemy.Target_state = state_enemy; enemy2animation.Target_state = state_animation; animation2player.Target_state = state_player; start2player.Target_state = state_player; state_player.addTransition(player2animation); state_animation.addTransition(animation2enemy); state_enemy.addTransition(enemy2animation); state_animation.addTransition(animation2player); state_start.addTransition(start2player); state_start.addAction(new Action(actionStartRunning)); state_player.Entry_action = new Action(actionPlayerEntry); state_player.addAction(new Action(actionPlayerRunning)); state_player.Exit_action = new Action(actionPlayerExit); state_animation.Entry_action = new Action(actionAnimationEntry); state_animation.addAction(new Action(actionAnimationRunning)); state_animation.Exit_action = new Action(actionAnimationExit); state_enemy.Entry_action = new Action(actionEnemyEntry); state_enemy.Exit_action = new Action(actionEnemyExit); state_start.Exit_action = new Action(actionStartExit); turn_manager = new Statemachine(state_start); }
// FUNCTION: Initialize the Main Program Form // // public MainForm() { // You know... InitializeComponent(); statemach = new Statemachine(); //tc = new testclass(); // Preload all bitmaps System.Reflection.Assembly assyThis = System.Reflection.Assembly.GetExecutingAssembly(); Stream fileImage = assyThis.GetManifestResourceStream("Cathreco.IonicLogo.bmp"); // set the starting bitmaps bitmap_CurrentRed = new Bitmap(fileImage); bitmap_LastSavedRed = new Bitmap(fileImage); // set the starting images into the pictboxes pictBox_Current.Image = bitmap_CurrentRed; pictBox_LastSaved.Image = bitmap_LastSavedRed; // Initialize bitmaps and pictboxes pictBox_Current.SizeMode = PictureBoxSizeMode.StretchImage; pictBox_LastSaved.SizeMode = PictureBoxSizeMode.StretchImage; rectRed.Width = pictBox_Current.Image.Width; rectRed.Height = pictBox_Current.Image.Height; // Get the name of the current record parameters file from the registry //strCurrentRecParamFile = (string)Registry.GetValue(@"HKEY_CURRENT_USER\AppEvents\Schemes\Apps\CathrecoSettings", @"PathRecParamFile", "Undefined"); // Loadup the current set of recording parameters LoadRecParamCurrent(); // Initialize the camera obviously. InitCamera(); // Open the ADU Device AduOpen(); }
//Initialise state machine //Diagram in the Google drive as "Game_manager_state_machine". //Hardcoded for now (Maybe file parsed in future). void initSM() { //Create the states for the state machine State state_menu = new State(); State state_play = new State(); State state_paused = new State(); State state_win = new State(); State state_lose = new State(); State state_start = new State(); //Create the transitions Transition menu2play = new Transition(); Transition play2paused = new Transition(); Transition play2win = new Transition(); Transition play2lose = new Transition(); Transition paused2play = new Transition(); Transition paused2menu = new Transition(); Transition win2play = new Transition(); Transition lose2menu = new Transition(); Transition start2menu = new Transition(); //Give the transitions a target state menu2play.Target_state = state_play; play2paused.Target_state = state_paused; play2win.Target_state = state_win; play2lose.Target_state = state_lose; paused2play.Target_state = state_play; paused2menu.Target_state = state_menu; win2play.Target_state = state_play; lose2menu.Target_state = state_menu; start2menu.Target_state = state_menu; //populate transitions with conditions menu2play.Trigger_condition = new TriggerCondition(conditionClickedPlay); play2paused.Trigger_condition = new TriggerCondition(conditionPressedEsc); play2win.Trigger_condition = new TriggerCondition(conditionWin); play2lose.Trigger_condition = new TriggerCondition(conditionLose); paused2play.Trigger_condition = new TriggerCondition(conditionClickedResume); paused2menu.Trigger_condition = new TriggerCondition(conditionClickedQuit); win2play.Trigger_condition = new TriggerCondition(conditionClickedContinue); play2lose.Trigger_condition = new TriggerCondition(conditionLose); lose2menu.Trigger_condition = new TriggerCondition(conditionClickedOkay); start2menu.Trigger_condition = new TriggerCondition(conditionTrue); //give transition some actions menu2play.Transition_Action = new Action(actionTransitionClickedPlay); win2play.Transition_Action = new Action(actionTransitionClickedContinue); lose2menu.Transition_Action = new Action(actionTransitionClickedOkay); paused2menu.Transition_Action = new Action(actionTransitionClickedQuit); //give states the populated transitions state_menu.addTransition(menu2play); state_play.addTransition(play2paused); state_play.addTransition(play2win); state_play.addTransition(play2lose); state_paused.addTransition(paused2menu); state_paused.addTransition(paused2play); state_win.addTransition(win2play); state_lose.addTransition(lose2menu); state_start.addTransition(start2menu); //Populate states with actions state_menu.Entry_action = new Action(actionMenuEntry); state_menu.addAction(new Action(actionMenuRunning)); state_menu.Exit_action = new Action(actionMenuExit); state_play.addAction(new Action(actionPlayRunning)); state_play.Exit_action = new Action(actionPlayExit); state_paused.Entry_action = new Action(actionPausedEntry); state_paused.Exit_action = new Action(actionPausedExit); state_win.Entry_action = new Action(actionWinEntry); state_win.addAction(actionWinRunning); state_win.Exit_action = new Action(actionWinExit); state_lose.Entry_action = new Action(actionLoseEntry); state_lose.Exit_action = new Action(actionLoseExit); //start state machine game_manager = new Statemachine(state_start); if (state_menu.List_transitions == null) { Debug.LogError("init transition null"); } }
public void InitState() { _statemachine = new Statemachine <State>(); _statemachine.Init(this); _statemachine.Next(State.Init); }
protected override void Awake() { base.Awake(); _statemachine = new Statemachine <State>(); _statemachine.Init(this); }
void Awake() { _statemachine = new Statemachine <State>(); _statemachine.Init(this); }
private void Start() { ScreenCapDirectory = Application.persistentDataPath + "/"; sm = FindObjectOfType <Statemachine>(); }
protected virtual void Awake() { _statemachine = new Statemachine <T>(); _statemachine.Init(this); _statemachine.Next((T)Enum.GetValues(typeof(T)).GetValue(0)); }
private void Awake() { statemachine_ = new Statemachine(gameObject); statemachine_.SetState(new SomeDefault()); world_handler_reference_ = GameObject.Find("World").GetComponent <WorldHandler>(); }
public void SetEnemyState(Statemachine newState) { currentState = newState; }