Exemple #1
0
        // PacketID 1
        // sends keyboard message
        public void SendMessage(Cloud.Library.InputState state)
        {
            NetOutgoingMessage msg = this.netClient.CreateMessage();

            msg.Write((byte)1);
            foreach (bool key in state.getStateList())
            {
                if (key)
                {
                    msg.Write((byte)1);
                }
                else
                {
                    msg.Write((byte)0);
                }
            }
            this.netClient.SendMessage(msg, NetDeliveryMethod.Unreliable);
        }
Exemple #2
0
 public void handleInputState(InputState inState)
 {
     if (inState.Up)
         this.Accelerate();
     if (inState.Down)
         this.Decelerate();
     if (inState.Left)
         this.TurnLeft();
     if (inState.Right)
         this.TurnRight();
 }
        public void handleInputState(InputState inState, String name)
        {
            foreach (Player player in playerList)
            {
                if (player.Name.Equals(name))
                {
                    player.handleInputState(inState);

                    if (inState.Space)
                    {
                        createBullet(player);
                    }
                    break;
                }
            }
        }