示例#1
0
        public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile       tile   = Main.tile[i, j];
            NestEntity entity = GetTE(i, j);

            if (entity == null || entity.owner == null)
            {
                return;
            }

            if (tile.frameX == 0 && tile.frameY == 0)
            {
                Vector2 center = (new Vector2(i + 1, j - 1) + Helper.TileAdj) * 16 + new Vector2(8, 0);
                spriteBatch.DrawString(Main.fontItemStack, entity.owner.name + "'s dragon\n" + entity.Dragon.data.name, center + new Vector2(0, -64) - Main.screenPosition - Main.fontItemStack.MeasureString(entity.Dragon.data.name) / 2, Color.White);
            }
        }
示例#2
0
        public override bool NewRightClick(int i, int j)
        {
            NestEntity entity = GetTE(i, j);

            if (entity == null)
            {
                return(false);
            }

            Item item = Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem];

            if (entity.owner == null && item.type == ItemType <Items.Dragons.Egg>())
            {
                entity.owner             = Main.LocalPlayer; //Sets the ID if the nest has not yet been claimed
                entity.Dragon.data.stage = GrowthStage.baby;
                int index = NPC.NewNPC(entity.Position.X * 16 + 27, entity.Position.Y * 16, NPCType <DragonEgg>());
                (Main.npc[index].modNPC as DragonEgg).nest = entity;
                item.TurnToAir(); //Absorbs the egg
            }

            return(true);
        }