Ejemplo n.º 1
0
        private void SpawnHero(Hero hero, int amount)
        {
            var outfits        = hero.OutfitPrefabs;
            var avatarRenderer = RaidUi.GetAvatarRenderer();
            var mainControl    = FindObjectOfType <MainControl>();

            for (var i = 0; i < amount; i++)
            {
                Slider hp;
                avatarRenderer.InitializeAvater(hero.AvatarPrefab, out hp, Names[Random.Range(0, Names.Count)]);
                var spawn        = SpawnPoint.transform.position + GetModification();
                var heroInstance = Instantiate(HeroPrefab, spawn, Quaternion.identity);
                heroInstance = hero.Builder.MakeHero(heroInstance);
                heroInstance.transform.SetParent(folder.transform);
                heroInstance.GetComponent <PlayerHealth>().AddHealthbar(hp);
                var outfit = Instantiate(outfits[Random.Range(0, outfits.Count)], heroInstance.transform);
                outfit.transform.SetParent(heroInstance.transform);
                count++;
                if (mainControl == null)
                {
                    continue;
                }
                mainControl.ControlGroups.Add(
                    count,
                    new List <MouseControllable> {
                    heroInstance.GetComponent <MouseControllable>()
                }
                    );
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            abilityRenderer = RaidUi.GetAbilityRenderer();
            var i = 0;

            abilities = AbilityScripts.Select(a => {
                var hotkey = Hotkeys[i];
                i++;
                return(new ActiveAbility {
                    Ability = a,
                    RemainingCooldown = 0,
                    Hotkey = hotkey
                });
            }).ToList();
        }