Beispiel #1
0
        public void BroadcastRocketStateUpdate(NitroxId id, NitroxId constructorId, TechType currentStageTech, GameObject builtGameObject)
        {
            Optional <NeptuneRocketModel> model = vehicles.TryGetVehicle <NeptuneRocketModel>(id);

            if (model.HasValue)
            {
                model.Value.CurrentStage += 1;
                packetSender.Send(new RocketStageUpdate(id, constructorId, model.Value.CurrentStage, currentStageTech, SerializationHelper.GetBytes(builtGameObject)));
            }
            else
            {
                Log.Error($"{nameof(Rockets)}: Can't find model for rocket with id {id} with constructor {constructorId} and currentStageTech {currentStageTech}");
            }
        }
Beispiel #2
0
        /** Rocket states :
         * 0 : Launch Platform
         * 1 : Gantry
         * 2 : Boosters
         * 3 : Fuel Reserve
         * 4 : Cockpit
         * 5 : Final rocket
         **/
        public void BroadcastRocketStateUpdate(NitroxId id, TechType currentStageTech)
        {
            Optional <NeptuneRocketModel> model = vehicles.TryGetVehicle <NeptuneRocketModel>(id);

            if (model.HasValue)
            {
                model.Value.CurrentStage += 1;

                //State 5 cannot be reached for the server based on players events, so we do it by hand
                if (model.Value.CurrentStage > 3)
                {
                    model.Value.CurrentStage = 5;
                }

                packetSender.Send(new RocketStageUpdate(id, model.Value.CurrentStage, currentStageTech));
            }
            else
            {
                Log.Error($"{nameof(Rockets.BroadcastRocketStateUpdate)}: Can't find model for rocket with id {id} and currentStageTech {currentStageTech}");
            }
        }