Inheritance: AngryTanks.Client.StaticSprite
Ejemplo n.º 1
0
        public void End(bool explode)
        {
            // we are no longer moving now
            Velocity = Vector2.Zero;

            // and we are ending, if we choose to explode, or go straight to ended
            if (explode)
                state = ShotState.Ending;
            else
                state = ShotState.Ended;

            explosion = new AnimatedSprite(World,
                                           World.Content.Load<Texture2D>("textures/bz/explode1"),
                                           Position,
                                           new Vector2(8, 8),
                                           Rotation,
                                           new Point(8, 8), new Point(64, 64), SpriteSheetDirection.RightToLeft, false);

            // we only broadcast the end shot if it's a local one we're keeping track of
            if (Local)
            {
                NetOutgoingMessage endShotMessage = World.ServerLink.CreateMessage();

                MsgEndShotPacket endShotPacket = new MsgEndShotPacket(this.Slot, explode);

                endShotMessage.Write((Byte)endShotPacket.MsgType);
                endShotPacket.Write(endShotMessage);

                World.ServerLink.SendMessage(endShotMessage, NetDeliveryMethod.ReliableUnordered, 0);
            }
        }
Ejemplo n.º 2
0
        public Player(World world, PlayerInformation playerInfo)
            : base(world, GetTexture(world, playerInfo), Vector2.Zero, GetTankSize(world, playerInfo), 0)
        {
            this.playerInfo = playerInfo;
            this.Score = new Score(); //Gives scoreHUD a valid reference to start with

            explosion = new AnimatedSprite(World,
                                           World.Content.Load<Texture2D>("textures/bz/explode1"),
                                           Position,
                                           GetTankSize(World, PlayerInfo) * 4,
                                           Rotation,
                                           new Point(8, 8), new Point(64, 64), SpriteSheetDirection.RightToLeft, false);

            explosion.Running = false;

            World.ServerLink.MessageReceivedEvent += HandleReceivedMessage;
        }