コード例 #1
0
 private void ApplyLogic(GameState s, float dt, DevCommandStopMotion c)
 {
     // TODO: Deprecate ?
     for (int z = 0; z < s.CGrid.numCells.Y; z++)
     {
         for (int x = 0; x < s.CGrid.numCells.X; x++)
         {
             Point   p   = new Point(x, z);
             Vector3 pos = new Vector3(x * 2 + 1, 0, z * 2 + 1);
             pos.Y = s.CGrid.HeightAt(new Vector2(pos.X, pos.Z));
             if (!s.CGrid.CanMoveTo(p, CollisionGrid.Direction.XP))
             {
                 s.AddParticle(new LightningParticle(
                                   pos + Vector3.UnitX, 1f, 12f, MathHelper.PiOver2,
                                   5f, 1, Color.LightBlue
                                   ));
             }
             if (!s.CGrid.CanMoveTo(p, CollisionGrid.Direction.XN))
             {
                 s.AddParticle(new LightningParticle(
                                   pos - Vector3.UnitX, 1f, 12f, MathHelper.PiOver2,
                                   5f, 1, Color.LightBlue
                                   ));
             }
             if (!s.CGrid.CanMoveTo(p, CollisionGrid.Direction.ZP))
             {
                 s.AddParticle(new LightningParticle(
                                   pos + Vector3.UnitZ, 1f, 12f, 0f,
                                   5f, 1, Color.LightBlue
                                   ));
             }
             if (!s.CGrid.CanMoveTo(p, CollisionGrid.Direction.ZN))
             {
                 s.AddParticle(new LightningParticle(
                                   pos - Vector3.UnitZ, 1f, 12f, 0f,
                                   5f, 1, Color.LightBlue
                                   ));
             }
         }
     }
 }
コード例 #2
0
        // Dev Callback
        public void OnDevCommand(string s)
        {
            DevCommand c;

            if (DevCommandSpawn.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandStopMotion.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandKillUnits.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandKillBuildings.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandFOW.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandSave.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
            else if (DevCommandCapital.TryParse(s, out c))
            {
                commands.Enqueue(c);
                return;
            }
        }