Пример #1
0
        public override bool NewRightClick(int i, int j)
        {
            Player player = Main.LocalPlayer;
            Tile   tile   = Main.tile[i, j];
            int    index  = GetInstance <TankEntity>().Find(i - tile.frameX / 18 * 16, j - tile.frameY / 18 * 16);

            if (index == -1)
            {
                return(true);
            }
            TankEntity entity = (TankEntity)TileEntity.ByID[index];

            if (player.HeldItem.modItem is StarjuiceStoringItem)
            {
                (player.HeldItem.modItem as StarjuiceStoringItem).Refuel(entity);
            }

            return(true);
        }
Пример #2
0
        public override void Update()
        {
            if (!Main.tile[Position.X, Position.Y].active())
            {
                Kill(Position.X, Position.Y);
            }

            if (tank == null)
            {
                for (int i = -6; i <= 6; i++)
                {
                    for (int j = -6; j <= 6; j++)
                    {
                        int index = ModContent.GetInstance <TankEntity>().Find(Position.X + i, Position.Y + j);
                        if (index != -1)
                        {
                            tank = (TankEntity)TileEntity.ByID[index]; i = 7; j = 7;
                        }
                    }
                }
            }

            else if (Main.tile[Position.X, Position.Y + 2].type == ModContent.TileType <CrystalBlock>() && tank.charge < tank.maxCharge)
            {
                Vector2 pos     = Position.ToVector2() * 16 + Vector2.One * 8;
                Vector2 tankpos = tank.Position.ToVector2() * 16 + new Vector2(24, -16);

                timer++;
                if (timer > 100 + variation)
                {
                    Dust.NewDustPerfect(Vector2.Lerp(pos, tankpos, (timer - (100 + variation)) / 20f), ModContent.DustType <Dusts.Starlight>());
                }

                if (timer >= 120 + variation)
                {
                    timer        = 0;
                    tank.charge += 10;
                    variation    = Main.rand.Next(-30, 30);
                }
            }
        }
Пример #3
0
        public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile tile  = Main.tile[i, j];
            int  index = GetInstance <TankEntity>().Find(i, j);

            if (index == -1)
            {
                return(true);
            }
            TankEntity entity = (TankEntity)TileEntity.ByID[index];

            if (tile.frameX == 0 && tile.frameY == 0)
            {
                Vector2 pos    = ((new Vector2(i, j) + Helper.TileAdj) * 16) + new Vector2(8, -28) - Main.screenPosition;
                int     charge = (int)(entity.charge / 5000f * 32f);

                spriteBatch.End();
                spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Additive);

                spriteBatch.Draw(GetTexture("StarlightRiver/RiftCrafting/Glow0"), pos + Vector2.One * -16, new Color(80, 150, 200) * (entity.charge / 5000f * 0.7f));

                spriteBatch.End();
                spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

                spriteBatch.Draw(GetTexture("StarlightRiver/Tiles/StarJuice/OrbIn"), new Rectangle((int)pos.X, (int)pos.Y + (32 - charge), 32, charge),
                                 new Rectangle(0, 0, 32, charge), Color.White, 0, Vector2.Zero, SpriteEffects.FlipVertically, 0);

                spriteBatch.Draw(GetTexture("StarlightRiver/Tiles/StarJuice/OrbOut"), pos, Lighting.GetColor(i + 1, j - 2));

                if (new Rectangle(i * 16, (j - 2) * 16, 48, 64).Contains(Main.MouseWorld.ToPoint()))
                {
                    string counter = entity.charge + "/" + entity.maxCharge;
                    float  scale   = 0.7f;
                    spriteBatch.DrawString(Main.fontMouseText, counter, pos + new Vector2(16 - Main.fontMouseText.MeasureString(counter).X *scale / 2, -24),
                                           Main.mouseTextColorReal * 0.75f, 0, Vector2.Zero, scale, 0, 0);
                }
            }
            return(true);
        }
Пример #4
0
        public override bool NewRightClick(int i, int j)
        {
            Player player = Main.LocalPlayer;
            Tile   tile   = Main.tile[i, j];
            int    index  = ModContent.GetInstance <TankEntity>().Find(i - tile.frameX / 18 * 16, j - tile.frameY / 18 * 16);

            if (index == -1)
            {
                return(true);
            }
            TankEntity entity = (TankEntity)TileEntity.ByID[index];

            if (player.HeldItem.modItem is StarjuiceStoringItem)
            {
                (player.HeldItem.modItem as StarjuiceStoringItem).Refuel(entity);
            }

            if (player.HeldItem.modItem is Items.Debug.DebugPlacer1) //debug code, remove later
            {
                entity.charge += 1000;
            }

            return(true);
        }