コード例 #1
0
        public static int ChangeAnim(ILuaState lua)
        {
            lua.L_CheckType(1, LuaType.LUA_TLIGHTUSERDATA);
            Entity c    = (Entity)lua.ToUserData(1);
            int    anim = lua.L_CheckInteger(2);
            DelayImpactComponent delayImpact = c.GetComponent <DelayImpactComponent>();

            if (delayImpact != null)
            {
                delayImpact.ChangeAnim(anim);
            }
            return(0);
        }
コード例 #2
0
        public static int PosAdd(ILuaState lua)
        {
            lua.L_CheckType(1, LuaType.LUA_TLIGHTUSERDATA);
            Entity c = (Entity)lua.ToUserData(1);
            DelayImpactComponent delayImpact = c.GetComponent <DelayImpactComponent>();

            if (delayImpact != null)
            {
                int x = lua.L_CheckInteger(2);
                int y = lua.L_CheckInteger(3);
                delayImpact.PosAdd(new Vector(Number.EN4 * x, Number.EN4 * y));
            }
            return(0);
        }
コード例 #3
0
ファイル: DelayImpactSystem.cs プロジェクト: CyberSys/Mugen3D
 protected override void ProcessEntity(List <Entity> entities)
 {
     foreach (var entity in entities)
     {
         DelayImpactComponent delayImpactComponent = entity.GetComponent <DelayImpactComponent>();
         if (delayImpactComponent.NewStateNo != -1)
         {
             var fsmComponent = entity.GetComponent <FSMComponent>();
             if (fsmComponent != null)
             {
                 fsmComponent.ChangeState(delayImpactComponent.NewStateNo);
             }
         }
         var moveComponent = entity.GetComponent <MoveComponent>();
         if (delayImpactComponent.NewFacing != 0)
         {
             if (moveComponent != null)
             {
                 moveComponent.ChangeFacing(delayImpactComponent.NewFacing);
             }
         }
         if (delayImpactComponent.NewAnimNo != -1)
         {
             var animComponent = entity.GetComponent <AnimationComponent>();
             if (animComponent != null)
             {
                 animComponent.ChangeAnim(delayImpactComponent.NewAnimNo);
             }
         }
         if (delayImpactComponent.NewVel != null)
         {
             if (moveComponent != null)
             {
                 moveComponent.VelSet(delayImpactComponent.NewVel.Value);
             }
         }
         if (delayImpactComponent.NewVelDelta != null)
         {
             if (moveComponent != null)
             {
                 moveComponent.VelAdd(delayImpactComponent.NewVelDelta.Value);
             }
         }
         if (delayImpactComponent.NewPos != null)
         {
             if (moveComponent != null)
             {
                 moveComponent.VelAdd(delayImpactComponent.NewPos.Value);
             }
         }
         if (delayImpactComponent.NewPosDelta != null)
         {
             if (moveComponent != null)
             {
                 moveComponent.VelAdd(delayImpactComponent.NewPosDelta.Value);
             }
         }
         //todo more
         delayImpactComponent.Clear();
     }
 }