Ejemplo n.º 1
0
        public VTMap getMap()
        {
            VTMap map;

            support.WriteLog($"Looking for Map ID {VTScenario.current.mapID}");
            map = VTResources.GetMap(VTScenario.current.mapID);
            support.WriteLog("Done looking for map id");
            if (map == null)
            {
                support.WriteLog("Getting custom map 1");
                VTMapCustom custommap = VTResources.GetCustomMap(VTScenario.current.mapID);
                return(custommap);
            }
            if (map == null)
            {
                support.WriteLog("Getting custom map 2");
                VTMapCustom custommap = VTResources.GetSteamWorkshopMap(VTScenario.current.mapID);
                return(custommap);
            }

            support.WriteLog("MM check");
            if (mm != null)
            {
                support.WriteLog("MM exists, Map null check?");
                if (map == null)
                {
                    support.WriteLog("Map not null. Get map from map manager");
                    return(VTMapManager.fetch.map);
                }
                else
                {
                    support.WriteLog("Map is null");
                }
            }
            else
            {
                support.WriteLog("Map Manager is null");
            }


            if (map != null)
            {
                support.WriteLog("Returning map.");
                return(map);
            }
            else
            {
                support.WriteLog("Unable to find a valid VTMap!");
                return(null);
            }
        }
Ejemplo n.º 2
0
        public VTMap getMap()
        {
            VTMap map;

            support.WriteLog($"Looking for Map ID {VTScenario.current.mapID}");
            map = VTResources.GetMap(VTScenario.current.mapID);
            if (map == null)
            {
                VTMapCustom custommap = VTResources.GetCustomMap(VTScenario.current.mapID);
                return(custommap);
            }
            if (map == null)
            {
                VTMapCustom custommap = VTResources.GetSteamWorkshopMap(VTScenario.current.mapID);
                return(custommap);
            }

            if (mm != null)
            {
                if (map == null)
                {
                    support.WriteLog("Got map from map manager");
                    return(VTMapManager.fetch.map);
                }
            }
            else
            {
                support.WriteLog("Map Manager is null");
            }



            if (map != null)
            {
                return(map);
            }
            else
            {
                support.WriteLog("Unable to find a valid VTMap!");
                return(null);
            }
        }
    public static List <Player> players = new List <Player>(); //This is the list of players
    /// <summary>
    /// This runs when the map has finished loading and hopefully
    /// when the player first can interact with the vehicle.
    /// </summary>
    /// <param name="customMap"></param>
    public static void MapLoaded(VTMapCustom customMap = null) //Clients and Hosts
    {
        Debug.Log("The map has loaded");
        gameLoaded = true;
        //As a client, when the map has loaded we are going to request a spawn point from the host
        SetPrefabs();
        if (!Networker.isHost)
        {
            Networker.SendP2P(Networker.hostID, new Message(MessageType.RequestSpawn), EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            hostLoaded = true;
            GameObject localVehicle = VTOLAPI.instance.GetPlayersVehicleGameObject();
            if (localVehicle != null)
            {
                GenerateSpawns(localVehicle.transform);
                localUID = Networker.GenerateNetworkUID();
                SendSpawnVehicle(localVehicle, localVehicle.transform.position, localVehicle.transform.rotation.eulerAngles, localUID);
            }
            else
            {
                Debug.Log("Local vehicle for host was null");
            }
            if (spawnRequestQueue.Count != 0)
            {
                SpawnRequestQueue();
            }
            Networker.alreadyInGame = true;
        }

        if (playersToSpawnQueue.Count != 0)
        {
            for (int i = 0; i < playersToSpawnQueue.Count; i++)
            {
                SpawnVehicle(playersToSpawnQueue.Dequeue());
            }
        }
    }