private void Start()
    {
        ObjectPooler = GetComponent <ObjectPool>();
        ImagePooler  = GetComponent <ImagePool>();

        players     = GetPlayers();
        startPoints = GetStartPoints();
        //MatchTime = gameInfo.gameTime;
        MATCH_DURATION = gameInfo.MatchTime;

        Debug.Log("GameInfo: " + gameInfo.ToString());

        AdjustCameraSize(gameInfo.MapSize);

        AdjustStartPositions(gameInfo.MapSize);

        countdown = MatchCountdown.Instance;
        countdown.SetMatchTime(MATCH_DURATION);
        countdown.ShowText("Match started", 3);

        //Debug.Log("Time: " + MatchTime + " <> " + gameInfo.gameTime);
        GetComponent <AsteroidsGenerator>().enabled = gameInfo.AsteroidsEnabled;

        if (gameInfo.BonusesEnbled)
        {
            BonusGenerator bonusGenerator = new BonusGenerator();
        }

        //Debug.Log("Bonuses: " + gameInfo.enableBonuses);
        for (int i = 0; i < players.Count; i++)
        {
            players[i].SetRespawnPoint(startPoints[i]);
            players[i].InitializeShip(i);
            players[i].onConnectionClose = OnPlayerConnectionClose;
        }

        if (PauseScreen.Instance != null)
        {
            PauseScreen.Instance.AddOnPauseEvent(delegate()
            {
                GameTime.Instance.SetTimeScale(0f);
                Cursor.visible = true;
            });

            PauseScreen.Instance.AddOnResumeEvent(delegate()
            {
                GameTime.Instance.SetTimeScaleTarget(1f);
                Cursor.visible = matchEnded;
            });
        }

        StartMatch();
    }
Exemple #2
0
 private void Awake()
 {
     Instance = this;
 }