private void Start() { //InvokeRepeating("UpdateDisplay", 0f, 0.05f); defeatedLayer = ScreenElement.BuildSprite("Defeated", RootParent.transform).SetSize(6, 7) .SetPosition(1, 1).SetTransparent(true).SetActive(false); eventLayer = ScreenElement.BuildSprite("Event", RootParent.transform).SetTransparent(true).SetActive(false); eyesLayer = ScreenElement.BuildSprite("Eyes", RootParent.transform).SetTransparent(true).SetActive(false); StartCoroutine(PAFlashDefeatedEffect()); StartCoroutine(PAFlashEventEffect()); StartCoroutine(PAFlashEyesEffect()); StartCoroutine(ConsumeQueue()); }
private void UpdateDisplay() { foreach (Transform child in RootParent) { if (child.gameObject.tag == "disposable") { Destroy(child.gameObject); } } int showLayer = 0; //0: none, 1: defeated, 2: event, 3: eyes. if (logicMgr.currentScreen == Screen.Character) { if (gm.IsCharacterDefeated) { showLayer = 1; } else if (gm.IsEventActive) { showLayer = 2; } else if (gm.showEyes) { showLayer = 3; } } defeatedLayer.SetActive(showLayer == 1); eventLayer.SetActive(showLayer == 2); eyesLayer.SetActive(showLayer == 3); int index; Sprite sprite; switch (logicMgr.currentScreen) { case Screen.CharSelection: SpriteBuilder sb = ScreenElement.BuildSprite("Arrows", screenDisplay.transform).SetSprite(spriteDB.arrows).SetTransparent(true); sb.gameObject.tag = "Disposable"; sb.transform.SetAsFirstSibling(); SetScreenSprite(spriteDB.GetCharacterSprites((GameChar)logicMgr.charSelectionIndex)[0]); break; case Screen.Character: SetScreenSprite(gm.PlayerCharSprites[gm.CurrentPlayerCharSprite]); break; case Screen.MainMenu: index = (int)logicMgr.currentMainMenu; sprite = spriteDB.mainMenu[index]; SetScreenSprite(sprite); break; case Screen.GamesMenu: index = logicMgr.gamesMenuIndex; sprite = spriteDB.game_sections[index]; SetScreenSprite(sprite); break; case Screen.GamesRewardMenu: index = logicMgr.gamesRewardMenuIndex; sprite = spriteDB.games_reward[index]; SetScreenSprite(sprite); break; case Screen.GamesTravelMenu: index = logicMgr.gamesTravelMenuIndex; sprite = spriteDB.games_travel[index]; SetScreenSprite(sprite); break; default: SetScreenSprite(spriteDB.emptySprite); break; } }