private string GetJsonParams(EnumHeroes code) { //подгрузка jsona string json = code.ToString(); return(json); }
private void CreateHero(EnumHeroes eHero) { MyHero = (IHero)heroFactroy.Create(eHero); MyHero.Ability = (IAbility)abilityFactory.Create(eHero); Debug.Log(MyHero.Health); MyHero.Attack(); MyHero.CastAbility(); MyHero.Death(); MyHero.Move(); MyHero.Resurection(); }
private void Start() { Button[] buttons = buttonsHeroes.GetComponentsInChildren <Button> (); for (int i = 0; i < buttons.Length; ++i) { int index = i; EnumHeroes eHero = GetHeroByID(index); buttons [i].GetComponentInChildren <Text> ().text = eHero.ToString(); buttons [i].onClick.AddListener(() => { CreateHero(eHero); }); } }
public object Create(object Enum) { EnumHeroes code = (EnumHeroes)Enum; IHero hero = null; switch (code) { case EnumHeroes.Carry: hero = new Carry(); break; case EnumHeroes.Disabler: hero = new Disabler(); break; case EnumHeroes.Jungler: hero = new Jungler(); break; case EnumHeroes.Nucker: hero = new Nucker(); break; case EnumHeroes.Roamer: hero = new Roamer(); break; case EnumHeroes.Support: hero = new Support(); break; case EnumHeroes.Tank: hero = new Tank(); break; } SetHeroStats(ref hero, GetJsonParams(code)); return(hero); }
private EnumHeroes GetHeroByID(int id) { EnumHeroes eHero = (EnumHeroes)id; return(eHero); }