예제 #1
0
 public Zombie(int x, int y)
     : base(x, y)
 {
     updateTimer.Start();
     lagTimer.Start();
     zombieBlock = Block.CreateBlock(0, xBlock, yBlock, 32, 0);
 }
예제 #2
0
 public override void Draw(Bot bot)
 {
     base.Draw(bot);
     if (xBlock != xOldBlock || yBlock != yOldBlock)
     {
         zombieBlock = Block.CreateBlock(0, xBlock, yBlock, 32, -1);
         bot.room.DrawBlock(zombieBlock);
         zombieOldBlock = Block.CreateBlock(0, xOldBlock, yOldBlock, 4, -1);
         bot.room.DrawBlock(zombieOldBlock);
     }
 }
예제 #3
0
 public static Block CreateText(int x, int y, string text)
 {
     Block block = new Block();
     block.blockType = "lb";
     block.dataArray = new object[] { 0, x, y, 1000, text };
     return block;
 }
예제 #4
0
 public static Block CreateSpike(int x, int y, int rotation)
 {
     Block block = new Block();
     block.blockType = "br";
     block.dataArray = new object[] { 0, x, y, 361, rotation };
     return block;
 }
예제 #5
0
 public static Block CreatePortal(int x, int y, int rotation, int id, int target)
 {
     Block block = new Block();
     block.blockType = "pt";
     block.dataArray = new object[] { 0, x, y, 242, rotation, id, target };
     return block;
 }
예제 #6
0
 public static Block CreateNoteBlock(int x, int y, int blockId, int soundId)
 {
     Block block = new Block();
     block.blockType = "bs";
     block.dataArray = new object[] { 0, x, y, blockId, soundId };
     return block;
 }
예제 #7
0
 public static Block CreateBlockCoin(int x, int y, int blockId, int coinsToOpen)
 {
     Block block = new Block();
     block.blockType = "bc";
     block.dataArray = new object[] { 0, x, y, blockId, coinsToOpen };
     return block;
 }
예제 #8
0
 public static Block CreateBlock(int layer, int x, int y, int blockId, int userId)
 {
     Block block = new Block();
     block.blockType = "b";
     block.dataArray = new object[] { layer, x, y, blockId, userId };
     return block;
 }
예제 #9
0
        public static bool Compare(Block a, Block b)
        {
            if (a == null || b == null)
                return false;

            if (a == b)
                return true;

            if (a.blockType != b.blockType)
                return false;

            if (a.blockId != b.blockId)
                return false;

            /*object[] dataArrayA = new object[a.dataArray.Length];
            object[] dataArrayB = new object[b.dataArray.Length];

            Array.Copy(dataArrayA, a.dataArray, a.dataArray.Length);
            Array.Copy(dataArrayB, b.dataArray, b.dataArray.Length);*/

            switch (a.blockType)
            {
                case "b":
                    return true;

                case "bc":
                    return a.dataArray[3] == b.dataArray[3];

                case "bs":
                    goto case "bc";

                case "pt":
                    return a.dataArray[3] == b.dataArray[3] && a.dataArray[4] == b.dataArray[4] && a.dataArray[5] == b.dataArray[5];

                case "lb":
                    goto case "bc";

                case "br":
                    goto case "bc";

                default:
                    return true;
            }
        }
예제 #10
0
        public override void onMessage(object sender, PlayerIOClient.Message m, Bot bot)
        {
            switch (m.Type)
            {
                case "init":
                    {
                        ResetRed();
                    }
                    break;

                case "b":
                    {
                        Block block = new Block(m);
                        Block oldBlock = bot.room.getBlock(block.layer, block.x, block.y, 1);

                        BlockPos position = new BlockPos(block.x, block.y, block.layer);

                        if (wireTypes.ContainsKey(oldBlock.blockId) || (block.blockId >= 9 && block.blockId <= 15))
                        {
                            if (!wireTypes.ContainsKey(block.blockId))
                            {
                                lock (this)
                                    ResetPowerSources();
                                break;
                            }
                        }
                        else if (powerSourceTypes.ContainsKey(oldBlock.blockId))
                        {
                            if (!powerSourceTypes.ContainsKey(block.blockId))
                            {
                                lock (this)
                                {
                                    RemoveWiresFromPowerSource(new KeyValuePair<BlockPos, PowerSource>(
                                        position,
                                        powerSourceTypes[oldBlock.blockId]));

                                    powerSources.Remove(position);
                                }
                            }
                        }
                        else if (destinationTypes.ContainsKey(oldBlock.blockId))
                        {
                            if (!destinationTypes.ContainsKey(block.blockId))
                            {
                                lock (this)
                                {
                                    if (destinations.ContainsKey(position))
                                    {
                                        destinations.Remove(position);
                                        ResetPowerSources();
                                    }
                                }
                                break;
                                /*lock (this)
                                    RemoveWiresFromDestination(new KeyValuePair<BlockPos, Destination>(
                                        new BlockPos(block.x, block.y, block.layer),
                                        destinationTypes[oldBlock.blockId]));*/
                            }
                        }

                        if (wireTypes.ContainsKey(block.blockId))
                        {
                            lock (this)
                                ResetPowerSources();
                        }
                        else if (powerSourceTypes.ContainsKey(block.blockId))
                        {
                            lock (this)
                            {
                                if (!powerSources.ContainsKey(new BlockPos(block.x, block.y, block.layer)))
                                {
                                    KeyValuePair<BlockPos, PowerSource> powerSourceKeyValuePair = new KeyValuePair<BlockPos, PowerSource>(new BlockPos(block.x, block.y, block.layer),
                                        powerSourceTypes[block.blockId].Clone() as PowerSource);
                                    powerSources.Add(powerSourceKeyValuePair.Key, powerSourceKeyValuePair.Value);
                                    ResetPowerSources();//ResetPowerSourceWires(powerSourceKeyValuePair);
                                }
                            }
                        }
                        else if (destinationTypes.ContainsKey(block.blockId))
                        {
                            lock (this)
                            {
                                if (!destinations.ContainsKey(new BlockPos(block.x, block.y, block.layer)))
                                {
                                    destinations.Add(new BlockPos(block.x, block.y, block.layer),
                                        destinationTypes[block.blockId].Clone() as Destination);
                                    ResetPowerSources();
                                }
                            }
                        }
                    }
                    break;
            }
        }