void ResetEnterColors(ChooseHero hero) { if (!isPlayerCanChoose) { return; } hero.SetBorderColor(defaultColor); }
void SetEnterColor(ChooseHero hero) { if (!isPlayerCanChoose) { return; } hero.SetBorderColor(playerOverColor); }
void ChangePlayerHero(ChooseHero hero) { if (!isPlayerCanChoose) { return; } if (currentPlayerHero != null) { currentPlayerHero.SetPlayer(1, false); } hero.SetPlayer(1, true); currentPlayerHero = hero; PlayerHeroImage.sprite = currentPlayerHero.HeroSprite; }
void ChooseAIHero() { foreach (var cur in heroes) { if (cur.HeroName == HeroesNames.Random) { if (currentAIHero != null) { currentAIHero.SetPlayer(2, false); } cur.SetPlayer(2, true); currentAIHero = cur; AIHeroImage.sprite = currentAIHero.HeroSprite; } } }
void Awake() { isPlayerCanChoose = true; PlayerHeroImage.sprite = UnknownHeroSprite; AIHeroImage.sprite = UnknownHeroSprite; currentPlayerHero = null; currentAIHero = null; foreach (var cur in heroes) { cur.HidePlayerImages(); cur.SetBorderColor(defaultColor); cur.OnClick += ChangePlayerHero; cur.OnMouseEnter += SetEnterColor; cur.OnMouseExit += ResetEnterColors; } ChooseAIHero(); HideWarningMessageBox(); }