コード例 #1
0
        public static IVehicleCmd CreateVehicleCmd(IVehicleCmdGenerator generator, VehicleContext context, PlayerEntity player, int currentSimulationTime)
        {
            if (!player.IsOnVehicle())
            {
                return(null);
            }

            var vehicle = context.GetEntityWithEntityKey(player.controlledVehicle.EntityKey);

            if (vehicle == null)
            {
                return(null);
            }


            var vehicleCmd = generator.GeneratorVehicleCmd(currentSimulationTime);

            if (vehicleCmd == null)
            {
                return(null);
            }

            vehicleCmd.PlayerId  = player.entityKey.Value.EntityId;
            vehicleCmd.VehicleId = vehicle.entityKey.Value.EntityId;

            if (!SharedConfig.ServerAuthorative)
            {
                vehicle.SetVehicleStateToCmd(vehicleCmd);
            }

            return(vehicleCmd);
        }
コード例 #2
0
        public UserCmdMergeSystem(Contexts contexts)
        {
            _vehicleCmdGenerator = new UnityVehicleCmdGenerator(contexts.userInput.userInputManager.Instance);
            _playerContext       = contexts.player;

            _simulationTimer = contexts.session.clientSessionObjects.SimulationTimer;

            _contexts = contexts;
        }