public Form1() { InitializeComponent(); ssm = new StackStateMachine(); ssm.OnProgramPrint += Ssm_OnProgramPrint; ssm.OnProgramFinish += Ssm_OnProgramFinish; }
public SubMachineExitOperation(int subState, int exitState, StackStateMachine machine, bool fireAgain = false) : base(machine) { _subState = subState; _exitState = exitState; _machine = machine; _fireAgain = fireAgain; }
void Start() { m_stateMachine = new StackStateMachine <Dog>(); m_stateMachine.AddState("Follow", new FollowState <Dog>(this)); m_stateMachine.AddState("Jump", new JumpState <Dog>(this)); m_stateMachine.AddState("Drop", new DropState <Dog>(this)); m_stateMachine.PushState("Follow"); m_animator = GetComponent <Animator>(); m_rigidBody2D = GetComponent <Rigidbody2D>(); m_startScale = transform.localScale; m_currentScale = m_startScale; }
void Start() { m_stateMachine = new StackStateMachine <Enemy>(); m_stateMachine.AddState("Patrol", new PatrolState <Enemy>(this)); m_stateMachine.AddState("Attack", new AttackState <Enemy>(this)); m_stateMachine.AddState("Seek", new SeekState <Enemy>(this)); m_stateMachine.AddState("Jump", new JumpState <Enemy>(this)); m_stateMachine.AddState("Drop", new DropState <Enemy>(this)); m_stateMachine.PushState("Patrol"); m_rigidbody2D = GetComponent <Rigidbody2D>(); m_animator = GetComponent <Animator>(); m_spriteRenderer = GetComponent <SpriteRenderer>(); m_startScale = transform.localScale; m_currentScale = m_startScale; m_attackReset = Random.Range(m_attackCooldown, m_attackCooldown + 0.25f); }
private void Ssm_OnProgramFinish(object sender, StackStateMachine e) { StringBuilder sb = new StringBuilder(); sb.Append("栈区内容:\r\n"); foreach (string s in e.runtimeStack) { sb.Append(TextUtil.escapeText(s)).Append("\r\n"); } sb.Append("\r\n寄存器内容:\r\n"); foreach (KeyValuePair <string, string> s in e.runtimeRegister) { sb.Append(s.Key + ":" + TextUtil.escapeText(s.Value)).Append("\r\n"); } sb.Append("\r\n用时:" + (InstructionUtils.GetTimestamp() - begintime).ToString() + "ms"); MessageBox.Show(sb.ToString(), "程序结束"); }
void Start() { m_healthBar = GetComponentInChildren <HealthBar>(); m_animator = GetComponent <Animator>(); m_perception = GetComponentInChildren <PerceptionSphere>(); m_stateMachine = new StackStateMachine <AI>(); m_rigidbody2D = GetComponent <Rigidbody2D>(); m_weapon = GetComponentInChildren <Weapon>(); m_renderer = GetComponent <SpriteRenderer>(); m_weapon.maxDamage = 25; m_weapon.minDamage = 10; m_weapon.m_targetTag = "Player"; m_stateMachine.AddState("ALERT", new AlertState <AI>(this)); m_stateMachine.AddState("ATTACK", new SwooshyState <AI>(this)); m_stateMachine.AddState("PATROL", new WanderState <AI>(this)); m_stateMachine.PushState("PATROL"); }
[TestCase("88*8*4*1+", ExpectedResult = -1)] //test uint12 overflow public short Should(string expression) { return(StackStateMachine.Solve(expression)); }