Esempio n. 1
0
    protected void InitServer()
    {
        if (Network.InitializeServer(MaxConnections, _port) == NetworkConnectionError.NoError)
        {
            //init map
            _choosingMap = PrefabLoader.GetMapModel(CSMapsName.cs_mansion);
            Instantiate(_choosingMap, Vector3.zero, Quaternion.LookRotation(Vector3.forward, Vector3.up));

            //init player
            Transform generator = CSMapPrefab.GetGenerator(_team, CSMapsName.cs_mansion);
            _player = PrefabLoader.GetCharacterModel(CSCharactersName.player);
            Instantiate(_player, generator.transform.position, generator.rotation);

            Screen.showCursor = false;
            _gameState        = GameState.PLAYING;
        }
    }
Esempio n. 2
0
    public static Transform GetGenerator(Team _team, string mapName)
    {
        ran.Next(0, 1);
        Transform  generator;
        GameObject model = PrefabLoader.GetMapModel(mapName);

        if (_team == Team.Counters)
        {
            Transform generators = model.transform.FindChild("CounterGenerates");
            int       index      = ran.Next(0, generators.childCount);
            generator = generators.GetChild(index);
        }
        else
        {
            Transform generaters = model.transform.FindChild("TerriorGenerates");
            int       index      = ran.Next(0, generaters.childCount);
            generator = generaters.GetChild(index);
        }
        return(generator);
    }