Exemplo n.º 1
0
		public void Enter(IFiniteStateMachine stateMachine, IState oldState) {
			EditorForm.b_entityremove.Checked = true;

			MultipleRemoveEntityAction removeAction = new MultipleRemoveEntityAction();

			foreach (MapEntity worldEntity in EntitySelectionTool.Instance.SelectedEntities) {
				RemoveEntityAction action = new RemoveEntityAction(EditorEngine.Instance.CurrentMap.Entities.IndexOf(worldEntity));
				action.Execute();
				removeAction.Actions.Add(action);
			}

			EditorEngine.Instance.GetActionManager().Push(removeAction);
			EntitySelectionTool.Instance.SelectedEntities.Clear();
			stateMachine.ChangeState(oldState);
		}
Exemplo n.º 2
0
        public void Enter(IFiniteStateMachine stateMachine, IState oldState)
        {
            EditorForm.b_entityremove.Checked = true;

            MultipleRemoveEntityAction removeAction = new MultipleRemoveEntityAction();

            foreach (MapEntity worldEntity in EntitySelectionTool.Instance.SelectedEntities)
            {
                RemoveEntityAction action = new RemoveEntityAction(EditorEngine.Instance.CurrentMap.Entities.IndexOf(worldEntity));
                action.Execute();
                removeAction.Actions.Add(action);
            }

            EditorEngine.Instance.GetActionManager().Push(removeAction);
            EntitySelectionTool.Instance.SelectedEntities.Clear();
            stateMachine.ChangeState(oldState);
        }
Exemplo n.º 3
0
    private void InitFSM()
    {
        Walk walk = new Walk(gameObject, finiteStateMachine, new Vector2(-15, 15), new Vector2(-7, 7), 3);
        Idle idle = new Idle(gameObject, finiteStateMachine);

        AntAI.States.RunAway runAway = new AntAI.States.RunAway(finiteStateMachine, gameObject, GameObject.FindGameObjectWithTag("Enemy").transform, 5);

        ITransition walkToIdle    = new WalkToIdle(gameObject, walk.target, walk, idle);
        ITransition idleToWalk    = new AntAI.Transitions.IdleToWalk(idle, walk, 1, 3);
        ITransition anyToRunAway  = new AntAI.Transitions.AnyToRunAway(runAway, transform, GameObject.FindGameObjectWithTag("Enemy").transform, 5);
        ITransition runAwayToIdle = new AntAI.Transitions.RunAwayToIdle(runAway, idle, 7, transform, GameObject.FindGameObjectWithTag("Enemy").transform);

        walk.Transitions.Add(walkToIdle);
        idle.Transitions.Add(idleToWalk);
        runAway.Transitions.Add(runAwayToIdle);
        finiteStateMachine.TransitionsFromAnyState.Add(anyToRunAway);
        finiteStateMachine.ChangeState(idle);
    }
Exemplo n.º 4
0
 public void Execute()
 {
     _owner.ChangeState(_target);
 }