Inheritance: MegaMan.Engine.Component
コード例 #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;
                        }
                    }
                }
            }
コード例 #2
0
        public override Component Clone()
        {
            StateComponent newone = new StateComponent {states = this.states};

            // notice the shallow copy!

            return newone;
        }
コード例 #3
0
        public override Component Clone()
        {
            StateComponent newone = new StateComponent {
                states = this.states
            };

            // notice the shallow copy!

            return(newone);
        }
コード例 #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);
                }
            });
        }
コード例 #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;
                        }
                    }
                }
            }
コード例 #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;
         }
     }
 }
コード例 #7
0
ファイル: StateComponent.cs プロジェクト: laazer/cs_megaman
 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;
         }
     }
 }