コード例 #1
0
    public void SelectHero(HeroEnum heroType, bool save = false)
    {
        var hero = Heroes.Where(h => h.HeroType == heroType).FirstOrDefault();

        SelectedHero = hero;

        var  renderer   = PlayerScript.GetComponent <SpriteRenderer>();
        bool isUnlocked = hero.IsUnlocked();

        renderer.sprite = hero.ShowoffSprite;
        renderer.color  = isUnlocked ? Color.white : Color.black;
        string unlockText = isUnlocked ? hero.Description : string.Format(GameEvents.ActionDisplayString(hero.GameCounter), SaveGame.Members.GetCounter(hero.GameCounter), hero.Req);

        TextHeroUnlock.text           = unlockText;
        TextHeroName.text             = hero.Name;
        Orc.Mood                      = hero.OrcMood;
        SaveGame.Members.SelectedHero = (int)hero.HeroType;

        UpdateButtonStates();

        if (save)
        {
            SaveGame.Save();
        }
    }