Пример #1
0
        public override void Process(VehicleUndocking packet)
        {
            GameObject vehicleGo           = GuidHelper.RequireObjectFrom(packet.VehicleGuid);
            GameObject vehicleDockingBayGo = GuidHelper.RequireObjectFrom(packet.DockGuid);

            Vehicle           vehicle           = vehicleGo.RequireComponent <Vehicle>();
            VehicleDockingBay vehicleDockingBay = vehicleDockingBayGo.RequireComponentInChildren <VehicleDockingBay>();

            using (packetSender.Suppress <VehicleUndocking>())
            {
                vehicles.SetOnPilotMode(packet.VehicleGuid, packet.PlayerId, true);
                vehicleDockingBay.subRoot.BroadcastMessage("OnLaunchBayOpening", SendMessageOptions.DontRequireReceiver);
                SkyEnvironmentChanged.Broadcast(vehicleGo, (GameObject)null);
                vehicleDockingBay.ReflectionSet("_dockedVehicle", null);
                vehicle.docked = false;
                vehicle.useRigidbody.AddForce(Vector3.down * 5f, ForceMode.VelocityChange);
            }
        }
Пример #2
0
        public override void Process(VehicleUndocking packet)
        {
            GameObject vehicleGo           = NitroxEntity.RequireObjectFrom(packet.VehicleId);
            GameObject vehicleDockingBayGo = NitroxEntity.RequireObjectFrom(packet.DockId);

            Vehicle           vehicle           = vehicleGo.RequireComponent <Vehicle>();
            VehicleDockingBay vehicleDockingBay = vehicleDockingBayGo.RequireComponentInChildren <VehicleDockingBay>();

            using (packetSender.Suppress <VehicleUndocking>())
            {
                vehicles.SetOnPilotMode(packet.VehicleId, packet.PlayerId, true);
                vehicleDockingBay.subRoot.BroadcastMessage("OnLaunchBayOpening", SendMessageOptions.DontRequireReceiver);
                SkyEnvironmentChanged.Broadcast(vehicleGo, (GameObject)null);



                vehicle.StartCoroutine(WaitBeforePushDown(vehicle, vehicleDockingBay));
            }
        }
Пример #3
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));
        }