void Start() { pongMaster = PongMaster.instance; switch (pongMaster.difficulty) { default: speed = speeds[1]; break; case Difficulty.easy: speed = speeds[0]; break; case Difficulty.medium: speed = speeds[1]; break; case Difficulty.hard: speed = speeds[2]; break; case Difficulty.ultimate: speed = speeds[3]; break; } Debug.Log("Ball Speed: " + speed); rb = GetComponent <Rigidbody>(); StartCoroutine(GenerateRandomVelocity()); }
void Awake() { PongMaster pongMaster = PongMaster.instance; pongMaster.timerGUI = GUIs[0]; pongMaster.textScoresGUI[0] = GUIs[1]; pongMaster.textScoresGUI[1] = GUIs[2]; pongMaster.paddle2 = paddle; pongMaster.gameEndTextGUI = GUIs[3]; PongMaster.instance.StartGame(); }
void Awake() { if (instance != null) { Debug.Log("Multiple instances of PongMaster found"); Destroy(gameObject); } instance = this; DontDestroyOnLoad(this); StartCoroutine("WaitToKillGame"); }
IEnumerator InitializeButtons() { pongMaster = PongMaster.instance; yield return(new WaitUntil(() => pongMaster.loadSettings)); foreach (ButtonType buttonType in buttonTypes) { switch (buttonType) { default: Debug.Log("Invalid ButtonType"); break; case ButtonType.launchGame: Debug.Log("Adding LaunchGame()"); button.onClick.AddListener(pongMaster.LaunchGame); break; case ButtonType.setPlayerType1: Debug.Log("Adding SetPlayers(true)"); button.onClick.AddListener(() => pongMaster.SetPlayers(true)); break; case ButtonType.setPlayerType2: Debug.Log("Adding SetPlayers(false)"); button.onClick.AddListener(() => pongMaster.SetPlayers(false)); break; case ButtonType.quitGame: Debug.Log("Adding QuitGame()"); button.onClick.AddListener(pongMaster.QuitGame); break; } } StopCoroutine("InitializeButtons"); }
void Start() { pongMaster = PongMaster.instance; }