Ejemplo n.º 1
0
            public WrappedState(
                StateBase <TStateId> state,

                Action <StateBase <TStateId> > beforeOnEnter = null,
                Action <StateBase <TStateId> > afterOnEnter  = null,

                Action <StateBase <TStateId> > beforeOnLogic = null,
                Action <StateBase <TStateId> > afterOnLogic  = null,

                Action <StateBase <TStateId> > beforeOnExit = null,
                Action <StateBase <TStateId> > afterOnExit  = null) : base(state.needsExitTime)
            {
                this.state = state;

                this.beforeOnEnter = beforeOnEnter;
                this.afterOnEnter  = afterOnEnter;

                this.beforeOnLogic = beforeOnLogic;
                this.afterOnLogic  = afterOnLogic;

                this.beforeOnExit = beforeOnExit;
                this.afterOnExit  = afterOnExit;
            }
Ejemplo n.º 2
0
        public StateMachine this[string name]
        {
            get
            {
                if (!states.ContainsKey(name))
                {
                    System.Exception exception = new System.Exception(
                        $"The state '{name}' has not been defined yet / doesn't exist"
                        );
                }

                StateBase selectedNode = states[name];

                if (!(selectedNode is StateMachine))
                {
                    System.Exception exception = new System.Exception(
                        $"The state '{name}' is not a StateMachine"
                        );
                }

                return((StateMachine)selectedNode);
            }
        }