Beispiel #1
0
    void Start()
    {

        Me = this;
        TerrianManager = transform.FindChild("TerrainManager").GetComponent<TerrianManager>();
        SpawnManager = transform.FindChild("SpawnManager").GetComponent<SpawnManager>();
        TurnManager = transform.FindChild("TurnManager").GetComponent<TurnManager>();
        DamageManager = transform.FindChild("DamageAndScoreManager").GetComponent<DamageManager>();
        ScoreManager = transform.FindChild("DamageAndScoreManager").GetComponent<ScoreManager>();
        DestroyManager = transform.FindChild("DestroyManager").GetComponent<DestroyManager>();
        WeaponManager = transform.FindChild("WeaponsManager").GetComponent<WeaponsCombo>();
        ModesManager = transform.FindChild("ModesManager").GetComponent<ModesCombo>();
        MapsManager = transform.FindChild("MapManager").GetComponent<MapManager>();
        PlayerInfos = SpawnManager.GetComponent<PlayerInfo>();

        MapsManager.StartMap((MapManager.Maps) RoundManager.RandomMap);
        SpawnManager.Spawn(TanksStaringCount);
        TurnManager.Begin();
        Wind.StartWind();
        WeaponsClass.InitiallizeWeaponsQuantities();
        ModesClass.InitiallizeModesQuantities();

#if (!Debug)
        for (int i = 0; i < WeaponsClass.WeaponsQuantities.Count; i++)
            WeaponsClass.WeaponsQuantities[WeaponsClass.WeaponsQuantities.ElementAt(i).Key] = 99;

        for (int i = 0; i < ModesClass.ModesQuantities.Count; i++)
            ModesClass.ModesQuantities[ModesClass.ModesQuantities.ElementAt(i).Key] = 99;
#endif

        PlayerInfos.DrawPlayerInfoInUI_SinglePlayer();



        //begin clouds
        GameObject.Find("Cloud").GetComponent<Cload_Movement>().Begin();
        GameObject.Find("Cloud (1)").GetComponent<Cload_Movement>().Begin();
        GameObject.Find("Cloud (2)").GetComponent<Cload_Movement>().Begin();

        //
        GameObject.Find("UIButtons").GetComponent<UIButtonClick>().InitilizeButtons();

        //show round loadout
        GameObject fade = GameObject.Find("Fade");
        fade.GetComponent<Fade>().ShowLoadout();
        HideHUDS();
    }
Beispiel #2
0
    private void DrawMenu()
    {
        float menuWidth  = 300;
        float menuHeight = 200;
        float menuLeft   = Screen.width / 2 - menuWidth / 2;
        float menuTop    = Screen.height / 2 - menuHeight / 2;

        float buttonWidth  = menuWidth - 2 * padding;
        float buttonHeight = 70;
        float buttonLeft   = menuLeft + padding;
        float buttonTop    = menuTop + padding;

        GUI.Box(new Rect(menuLeft, menuTop, menuWidth, menuHeight), "");
        string startButtonText = "New Game";

        if (started)
        {
            startButtonText = "Resume";
        }
        if (GUI.Button(new Rect(buttonLeft, buttonTop, buttonWidth, buttonHeight), startButtonText))
        {
            if (soundManager)
            {
                soundManager.PlaySound("ButtonClick");
            }
            Time.timeScale = 1.0f;
            if (!started)
            {
                started = true;
                foreach (Player player in players)
                {
                    player.Begin();
                }
                if (turnManager)
                {
                    turnManager.Begin();
                }
            }
            else
            {
                foreach (Player player in players)
                {
                    player.Resume();
                }
                if (turnManager)
                {
                    turnManager.Resume();
                }
            }
            if (finished)
            {
                finished = false;
            }
            showMenu = false;
            if (hud)
            {
                hud.Begin();
            }
            if (userInput)
            {
                userInput.enabled = true;
            }
        }
        buttonTop += buttonHeight + padding;
        if (GUI.Button(new Rect(buttonLeft, buttonTop, buttonWidth, buttonHeight), "Exit"))
        {
            if (soundManager)
            {
                soundManager.PlaySound("ButtonClick");
            }
            Application.Quit();
        }
        if (finished)
        {
            float labelHeight = 40;
            float labelWidth  = Screen.width - 4 * padding;
            float boxHeight   = labelHeight + padding;
            float boxWidth    = labelWidth + 2 * padding;
            float boxTop      = menuTop - boxHeight - padding;
            float boxLeft     = padding;
            GUI.Box(new Rect(boxLeft, boxTop, boxWidth, boxHeight), "");
            GUI.Label(new Rect(boxLeft + padding, boxTop + padding / 2, labelWidth, labelHeight), winningMessage);
        }
    }