Inheritance: MegaMan.Engine.Component
Exemplo n.º 1
0
            public void CheckTriggers(StateComponent statecomp, IEntity entity)
            {
                string state = statecomp.currentState;

                foreach (Trigger trigger in triggers.OrderBy(t => t.Priority))
                {
                    bool result = trigger.Condition(entity);
                    if (result)
                    {
                        trigger.Effect(entity);
                        if (statecomp.currentState != state)
                        {
                            break;
                        }
                    }
                    else if (trigger.Else != null)
                    {
                        trigger.Else(entity);
                        if (statecomp.currentState != state)
                        {
                            break;
                        }
                    }
                }
            }
Exemplo n.º 2
0
        public override Component Clone()
        {
            StateComponent newone = new StateComponent {states = this.states};

            // notice the shallow copy!

            return newone;
        }
Exemplo n.º 3
0
        public override Component Clone()
        {
            StateComponent newone = new StateComponent {
                states = this.states
            };

            // notice the shallow copy!

            return(newone);
        }
Exemplo n.º 4
0
        // this is for when <State> appears in an effect, used for changing state
        public static Effect ParseEffect(XElement effectNode)
        {
            string newstate = effectNode.Value;

            return(entity =>
            {
                StateComponent state = entity.GetComponent <StateComponent>();
                if (state != null)
                {
                    state.ChangeState(newstate);
                }
            });
        }
Exemplo n.º 5
0
            public void CheckTriggers(StateComponent statecomp, IEntity entity)
            {
                string state = statecomp.currentState;

                foreach (Trigger trigger in triggers)
                {
                    bool result = trigger.Condition(entity);
                    if (result)
                    {
                        trigger.Effect(entity);
                        if (statecomp.currentState != state)
                        {
                            break;
                        }
                    }
                }
            }
Exemplo n.º 6
0
 public void CheckTriggers(StateComponent statecomp, IEntity entity)
 {
     string state = statecomp.currentState;
     foreach (Trigger trigger in triggers.OrderBy(t => t.Priority))
     {
         bool result = trigger.Condition(entity);
         if (result)
         {
             trigger.Effect(entity);
             if (statecomp.currentState != state)
                 break;
         }
         else if (trigger.Else != null)
         {
             trigger.Else(entity);
             if (statecomp.currentState != state)
                 break;
         }
     }
 }
Exemplo n.º 7
0
 public void CheckTriggers(StateComponent statecomp, IEntity entity)
 {
     string state = statecomp.currentState;
     foreach (Trigger trigger in triggers)
     {
         bool result = trigger.Condition(entity);
         if (result)
         {
             trigger.Effect(entity);
             if (statecomp.currentState != state) break;
         }
     }
 }