示例#1
0
        private void StartVehicleUndocking(VehicleUndocking packet, GameObject vehicleGo, Vehicle vehicle, VehicleDockingBay vehicleDockingBay)
        {
            Optional <RemotePlayer> player = remotePlayerManager.Find(packet.PlayerId);

            vehicleDockingBay.subRoot.BroadcastMessage("OnLaunchBayOpening", SendMessageOptions.DontRequireReceiver);
            SkyEnvironmentChanged.Broadcast(vehicleGo, (GameObject)null);

            if (player.HasValue)
            {
                RemotePlayer playerInstance = player.Value;
                vehicle.mainAnimator.SetBool("player_in", true);
                playerInstance.Attach(vehicle.playerPosition.transform);
                // It can happen that the player turns in circles around himself in the vehicle. This stops it.
                playerInstance.RigidBody.angularVelocity = Vector3.zero;
                playerInstance.ArmsController.SetWorldIKTarget(vehicle.leftHandPlug, vehicle.rightHandPlug);
                playerInstance.AnimationController["in_seamoth"] = vehicle is SeaMoth;
                playerInstance.AnimationController["in_exosuit"] = playerInstance.AnimationController["using_mechsuit"] = vehicle is Exosuit;
                vehicles.SetOnPilotMode(packet.VehicleId, packet.PlayerId, true);
                playerInstance.AnimationController.UpdatePlayerAnimations = false;
            }
            vehicleDockingBay.StartCoroutine(StartUndockingAnimation(vehicleDockingBay));
        }