private void StartGameButtonHandler(object sender, EventArgs e) //кнопка для начала игры { //скрытие всех начальных элементов формы StartGameButton.Hide(); Ship1.Hide(); Ship2.Hide(); Ship3.Hide(); Ship4.Hide(); Ship5.Hide(); Ship6.Hide(); MartianBattleLabel.Hide(); //определение управляющего объекта m_controlGame = new Controller(this, NumbersOfLives, Platform, new TextBox[] { Ship1, Ship2, Ship3, Ship4, Ship5, Ship6 }); m_controlGame.StartGame(); //запуск игры }
void Awake() { Index = PlayerPrefs.GetInt("ShipSelection"); Ship0 = GameObject.Find("Ship0"); Ship1 = GameObject.Find("Ship1"); Ship2 = GameObject.Find("Ship2"); Ship3 = GameObject.Find("Ship3"); Ship4 = GameObject.Find("Ship4"); Ship5 = GameObject.Find("Ship5"); if (Index == 0) { Ship0.SetActive(true); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship0"); } if (Index == 1) { Ship0.SetActive(false); Ship1.SetActive(true); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship1"); } if (Index == 2) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(true); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship2"); } if (Index == 3) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(true); Ship4.SetActive(false); Ship5.SetActive(false); Player = GameObject.Find("Ship3"); } if (Index == 4) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(true); Ship5.SetActive(false); Player = GameObject.Find("Ship4"); } if (Index == 5) { Ship0.SetActive(false); Ship1.SetActive(false); Ship2.SetActive(false); Ship3.SetActive(false); Ship4.SetActive(false); Ship5.SetActive(true); Player = GameObject.Find("Ship5"); } }