// Use this for initialization private void Update() { if (_isSet || !Input.GetKey(KeyCode.Alpha1)) { return; } ClassSetter.SetClassToHero(Hero, HeroClassConfig); _isSet = true; Destroy(gameObject); }
public Hero Create(Hero heroPrefab, Transform spawnPlace, HeroClassEnum heroClass) { // Create hero and set position and parent for him var heroInstance = Instantiate(heroPrefab, HeroParentTransform); heroInstance.transform.position = spawnPlace.transform.position; // Set class for hero ClassSetter.SetClassToHero(heroInstance, _heroClassGetter.GetClassConfig(heroClass)); // Create Hp view for hero _hpHpCreator.Create(HpShowerPrefab, HeroParentTransform, heroInstance.GetLiveble()); return(heroInstance); }