コード例 #1
0
        public override bool NewRightClick(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            int  left = i - (tile.frameX % 36) / 18;
            int  top  = j - (tile.frameY % 36) / 18;

            int index = GetInstance <TETurret>().Find(left, top);

            if (index != -1)
            {
                TETurret ent = (TETurret)TileEntity.ByID[index];

                if (!MoreMechanisms.instance.TurretUIVisible())
                {
                    MoreMechanisms.instance.turretUIState.i = i * 16;
                    MoreMechanisms.instance.turretUIState.j = j * 16;

                    MoreMechanisms.instance.ShowTurretUI(ent.bullets, (Item it) => {
                        ent.bullets = it;
                    });
                }
            }

            return(true);
        }
コード例 #2
0
        public override void HitWire(int i, int j)
        {
            base.HitWire(i, j);

            Tile tile = Main.tile[i, j];
            int  left = i - (tile.frameX % 36) / 18;
            int  top  = j - (tile.frameY % 36) / 18;

            int index = GetInstance <TETurret>().Find(left, top);

            if (index != -1)
            {
                TETurret qe = (TETurret)TileEntity.ByID[index];

                qe.on = !qe.on;
                if (qe.on)
                {
                    Main.PlaySound(SoundID.Item23, left * 16, top * 16);
                }
            }
        }