Exemple #1
0
        public static void PlayerMovement(int _fromClient, Packet _packet)
        {
            bool[] _inputs = new bool[_packet.ReadInt()];
            for (int i = 0; i < _inputs.Length; i++)
            {
                _inputs[i] = _packet.ReadBool();
            }
            Quaternion _rotation = _packet.ReadQuaternion();

            MainServer.clients[_fromClient].player.SetInput(_inputs, _rotation);
        }
        public static void PlayerMovement(int fromClient, Packet packet)
        {
            bool[] inputs = new bool[packet.ReadInt()];
            for (int i = 0; i < inputs.Length; i++)
            {
                inputs[i] = packet.ReadBool();
            }

            Quaternion rotation = packet.ReadQuaternion();

            Server.Clients[fromClient].player.SetInput(inputs, rotation);
        }
Exemple #3
0
        public static void PlayerInput(Guid _fromClient, Packet _packet)
        {
            bool[] _inputs = new bool[_packet.ReadInt()];
            for (int i = 0; i < _inputs.Length; i++)
            {
                _inputs[i] = _packet.ReadBool();
            }

            Quaternion _rotation = _packet.ReadQuaternion();

            GameManager.Get.Players[_fromClient].HandleInput(_inputs, _rotation);
        }
Exemple #4
0
        public static void TrooperTransformUpdate(Packet packet)
        {
            int        id       = packet.ReadInt();
            Vector3    position = packet.ReadVector3();
            Quaternion rotation = packet.ReadQuaternion();
            Vector3    velocity = packet.ReadVector3();
            bool       grounded = packet.ReadBool();

            GameManager.players[id].trooper.transform.position = position;
            GameManager.players[id].trooper.transform.rotation = rotation;
            GameManager.players[id].trooper.velocity           = velocity;
            GameManager.players[id].trooper.grounded           = grounded;

            if (id != Client.instance.myId)
            {
                return;
            }
            TrooperController.instance.rigidbody.velocity = velocity;
            TrooperController.instance.grounded           = grounded;
        }
Exemple #5
0
        public static void TrooperGrappleUpdate(Packet packet)
        {
            int     id                     = packet.ReadInt();
            bool    isGrappling            = packet.ReadBool();
            string  objectId               = packet.ReadString();
            Vector3 position               = packet.ReadVector3();
            float   maxDistanceFromGrapple = packet.ReadFloat();

            GameManager.players[id].trooper.isGrappling            = isGrappling;
            GameManager.players[id].trooper.grappleObjectId        = objectId;
            GameManager.players[id].trooper.grapplePoint           = position;
            GameManager.players[id].trooper.maxDistanceFromGrapple = maxDistanceFromGrapple;

            if (id != Client.instance.myId)
            {
                return;
            }
            GrapplingGun.instance.grappling    = isGrappling;
            GrapplingGun.instance.grapplePoint = position;
            GrapplingGun.instance.maxDistance  = maxDistanceFromGrapple;
        }