public void OnRoomJoin(BaseEvent evt) { Room room = evt == null ? null : (Room)evt.Params["room"]; if (room != null && IsPrivateRoom(room.Name)) { OnPrivateRoomJoin(room); return; } GameManager.Inst.RoomJoinEvt = evt; AnnouncementManager.Inst.Clear(); if (loadUnityLevelOnRoomJoin) { Debug.LogError("Loading next level ( " + levelToLoad.ToString() + " )"); if (GameManager.Inst.ServerConfig == "UCI" && levelToLoad == GameManager.Level.CAMPUS) { levelToLoad = GameManager.Level.MINICAMPUS; Debug.LogError("Detected trying to load campus for UCI, loading minicampus"); } StartCoroutine(LoadLevelAync(LevelInfo.GetInfo(levelToLoad).sceneName)); } else { HideUser(); // users were still displaying in the scenes for other clients, so hide them. } if (GameManager.InBatchMode()) { AddMonitorUserVariables(); } }
/*DEBUG*/ void SETDEBUGLEVELS() { debugText.text = "DEBUG \n" + Mode.ToString() + "\n" + Difficulty.ToString() + "\n"; for (int i = 0; i < EnemyFactories.Count; i++) { debugText.text = debugText.text + EnemyFactories[i].GETLEVELSTRING(); } for (int i = 0; i < ItemFactories.Count; i++) { debugText.text = debugText.text + ItemFactories[i].GETLEVELSTRING(); } }
public void UIInit(int initialHealth, GameManager.GameMode mode, /*DEBUG*/ GameManager.Level difficulty, /*DEBUG*/ List <ObjectFactory> enemyFactories, /*DEBUG*/ List <ObjectFactory> itemFactories, List <Sprite> playerSprites, int numberOfPlayers, GameManager.ColorBlindness Blinesstype) { float BotLeftCorner = -10.2f; GameObject canvas = GameObject.Find("Canvas"); HealthIdicators = new List <GameObject>(); ScoresIdicators = new List <GameObject>(); IsUIInit = true; Mode = mode; NumberOfPlayers = numberOfPlayers; InitialHealth = initialHealth; HealthPrefab = Resources.Load <GameObject>("Prefabs/HealthIndicator"); PlayerSprites = new List <Sprite>(playerSprites); Platforms = GameObject.FindGameObjectsWithTag("Platform"); countdownDisplay = Instantiate(Resources.Load <GameObject>("Prefabs/countdownDisplay"), new Vector3(0, 0, 0), transform.rotation); countdownDisplay.transform.SetParent(canvas.transform); countdownDisplay.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); gameModDisplay = Instantiate(Resources.Load <GameObject>("Prefabs/GameModeDisplay"), new Vector3(9, -5.5f, 0), transform.rotation); gameModDisplay.transform.SetParent(canvas.transform); gameModDisplay.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); if (Mode == GameManager.GameMode.Competitive) { gameModDisplay.GetComponent <Text>().text = "Competitive"; } else { gameModDisplay.GetComponent <Text>().text = "Cooperative"; } CountDownStart(); for (int i = 0; i < NumberOfPlayers; i++) { HealthIdicators.Add(Instantiate(HealthPrefab, new Vector3(BotLeftCorner + ((float)i * 2.5f), -5.4f, 0), transform.rotation)); HealthIdicators[i].transform.SetParent(canvas.transform); HealthIdicators[i].GetComponent <Image>().sprite = PlayerSprites[i]; HealthIdicators[i].GetComponentInChildren <Text>().text = InitialHealth.ToString(); HealthIdicators[i].GetComponent <RectTransform>().localScale = new Vector3(0.12f, 0.12f, 0.12f); } if (Mode == GameManager.GameMode.Cooperative) { ScoresIdicators.Add(new GameObject("Score")); InitScoreText(ScoresIdicators[0]); ScoresIdicators[0].transform.position = new Vector3(BotLeftCorner + (((float)NumberOfPlayers + 0.7f) * 3f), -6.5f, 0); ScoresIdicators[0].GetComponent <Text>().color = new Color(0f, 0f, 0f); } else { for (int i = 0; i < NumberOfPlayers; i++) { ScoresIdicators.Add(new GameObject("Score")); InitScoreText(ScoresIdicators[i]); ScoresIdicators[i].transform.position = new Vector3(HealthIdicators[i].transform.position.x + 0.8f, HealthIdicators[i].transform.position.y - 0.2f, 0); } } if (Blinesstype == GameManager.ColorBlindness.Protanopia) { GameObject.Find("BackGround").GetComponent <SpriteRenderer>().color = new Color(0.3f, 0.3f, 0.5f); foreach (var item in Platforms) { item.GetComponent <SpriteRenderer>().color = new Color(1f, 0.5f, 0.5f); } } else if (Blinesstype == GameManager.ColorBlindness.Tritanopia) { GameObject.Find("BackGround").GetComponent <SpriteRenderer>().color = new Color(0f, 1f, 1f); foreach (var item in Platforms) { item.GetComponent <SpriteRenderer>().color = new Color(1f, 0.7f, 0.3f); } } // UI Debug DebugIndicator = new GameObject("DEBUGMODE"); Difficulty = difficulty; DebugIndicator.layer = 5; DebugIndicator.transform.SetParent(canvas.transform); DebugIndicator.transform.position = new Vector3(-8.3f, 2.7f, 0); debugText = DebugIndicator.AddComponent <Text>(); RectTransform rt = DebugIndicator.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(200, 200); debugText.fontSize = 12; debugText.font = Resources.GetBuiltinResource <Font>("Arial.ttf"); debugText.text = "DEBUG \n" + Mode.ToString() + "\n" + Difficulty.ToString(); debugText.GetComponent <RectTransform>().localScale = new Vector3(0.8f, 0.8f, 0.8f); EnemyFactories = enemyFactories; ItemFactories = itemFactories; }