示例#1
0
        public void CmdLmove(int bid, CoordinateDifference d1, CoordinateDifference d2)
        {
            if (!Bots.TryGetValue(bid, out var bot))
            {
                throw new CommandException("lmove", "bot does not exist");
            }

            bot.Position = Matrix.Get(bot.Position.X + d1.X + d2.X, bot.Position.Y + d1.Y + d2.Y, bot.Position.Z + d1.Z + d2.Z);
        }
示例#2
0
        public void CmdVoid(int bid, CoordinateDifference d)
        {
            if (!Bots.TryGetValue(bid, out var bot))
            {
                throw new CommandException("void", "bot does not exist");
            }

            Matrix.Get(bot.Position.X + d.X, bot.Position.Y + d.Y, bot.Position.Z + d.Z).Filled = false;
        }
示例#3
0
        private static CoordinateDifference[] GenerateNearDistances()
        {
            List <CoordinateDifference> nearDistances = new List <CoordinateDifference>();

            for (sbyte x = -1; x <= 1; x++)
            {
                for (sbyte y = -1; y <= 1; y++)
                {
                    for (sbyte z = -1; z <= 1; z++)
                    {
                        var d = new CoordinateDifference(x, y, z);
                        if (d.IsNear)
                        {
                            nearDistances.Add(d);
                        }
                    }
                }
            }

            return(nearDistances.ToArray());
        }
示例#4
0
        public void CalculateNearby(Voxel voxel)
        {
            var nearby = new List <Voxel>();

            for (sbyte x = -1; x <= 1; x++)
            {
                for (sbyte y = -1; y <= 1; y++)
                {
                    for (sbyte z = -1; z <= 1; z++)
                    {
                        var d = new CoordinateDifference(x, y, z);
                        if (d.IsNear && ValidCoord(voxel.X + d.X, voxel.Y + d.Y, voxel.Z + d.Z))
                        {
                            nearby.Add(Translate(voxel, d));
                        }
                    }
                }
            }

            voxel.Nearby = nearby.ToArray();
        }
示例#5
0
 public Voxel Translate(Voxel start, CoordinateDifference offset)
 {
     return(Get(start.X + offset.X, start.Y + offset.Y, start.Z + offset.Z));
 }