コード例 #1
0
ファイル: CTF.cs プロジェクト: chigbojk/CapereCraft
        public static void tntMineProximity(Player p, ushort x, ushort y, ushort z)
        {
            int size = 2;

            if (p.hasBigTNT)
            {
                size = 4;
            }
            Player owner = null;

            foreach (Mine m in Mine.Mines)
            {
                for (int cx = x - size; cx <= x + size; cx++)
                {
                    for (int cy = y - size; cy <= y + size; cy++)
                    {
                        for (int cz = z - size; cz <= z + size; cz++)
                        {
                            if (m.loc[0] == cx && m.loc[1] == cy && m.loc[2] == cz)
                            {
                                ushort[] loc = new ushort[3];
                                loc[0] = (ushort)cx; loc[1] = (ushort)cy; loc[2] = (ushort)cz;
                                owner  = m.owner;
                                Mine.deleteMine(m, p, CTF.gameLevel, loc, true);
                                Message(owner.ctfColor + possessionRule(owner.name) + " mine was defused by " + p.ctfColor + p.name);
                                p.points += 3;
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: CTF.cs プロジェクト: chigbojk/CapereCraft
 public static void mineProximity()
 {
     foreach (Mine m in Mine.Mines.ToArray())
     {
         int size = 2;
         int x    = m.loc[0];
         int y    = m.loc[1];
         int z    = m.loc[2];
         for (int cx = x - size; cx <= x + size; cx++)
         {
             for (int cy = y - size; cy <= y + size; cy++)
             {
                 for (int cz = z - size; cz <= z + size; cz++)
                 {
                     foreach (Player p in m.owner.opponentTeam().players.ToArray())
                     {
                         if ((p.footLocation[0] == cx && p.footLocation[1] == y && p.footLocation[2] == z) || (p.headLocation[0] == x && p.headLocation[1] == y && p.headLocation[2] == z))
                         {
                             Message(m.owner.ctfColor + m.owner.name + c.def + " mined " + p.ctfColor + p.name);
                             Mine.deleteMine(m, m.owner, gameLevel, m.loc, true);
                             m.owner.hasMine = false;
                         }
                     }
                 }
             }
         }
     }
 }