示例#1
0
        // Use this for initialization
        private void Start()
        {
            #if UNITY_IOS
            NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound, false);
            #endif

            _mageFactory = new MageFactory(MageUpgradeManager.MagePrefabs, this);
            ElementController.Instance.TowerTextures  = TowerTextures;
            ElementController.Instance.ShrineTextures = ShrineTextures;
            ElementController.Instance.MageTextures   = MageTextures;
            ElementController.Instance.SpellParticles = SpellParticles;
            ElementController.Instance.ElementIcons   = ElementIcons;

            MageUpgradeManager.Init();

            if (PlayerPrefs.GetInt("sfxMute") == 1)
            {
                SFXSlider.AssignSlider();
                if (_audioManager && _audioManager.SFXAudio.mute)
                {
                    _audioManager.ToggleSound();
                }
                SFXSlider.ChangeValue();
            }

            if (PlayerPrefs.GetInt("musicMute") == 1)
            {
                MusicSlider.AssignSlider();
                if (_audioManager && _audioManager.MusicAudio.mute)
                {
                    _audioManager.ToggleMusic();
                }
                MusicSlider.ChangeValue();
            }

            //Currency Bonus
            if (!string.IsNullOrEmpty(PlayerPrefs.GetString("_currencyBonusEndTime")))
            {
                _currencyModifierEndTime = DateTime.Parse(PlayerPrefs.GetString("_currencyBonusEndTime"));
                if (_currencyModifierEndTime > DateTime.Now)
                {
                    var restTime = AdManager.BonusTime - (_currencyModifierEndTime - DateTime.Now).TotalSeconds;
                    _currencyModifier = PlayerPrefs.GetFloat("_currencyModifier");
                    UIManager.OpenCurrencyBonus(_currencyModifier);
                    AdManager.Timer.Cooldown((float)restTime, Time.time);
                }
            }
            //Damage Bonus
            if (!string.IsNullOrEmpty(PlayerPrefs.GetString("_damageBonusEndTime")))
            {
                _damageModifierEndTime = DateTime.Parse(PlayerPrefs.GetString("_damageBonusEndTime"));
                if (_damageModifierEndTime > DateTime.Now)
                {
                    var restTime = AdManager.BonusTime - (_damageModifierEndTime - DateTime.Now).TotalSeconds;
                    _damageModifier = PlayerPrefs.GetFloat("_damageModifier");
                    UIManager.OpenDamageBonus(_damageModifier);
                    AdManager.Timer.Cooldown((float)restTime, Time.time);
                }
            }
        }
示例#2
0
 public void CreateMagesFromDataArray(MageFactory mageFactory)
 {
     _mageObjectList = new List <Mage>();
     for (var i = 0; i < _mageList.Count; i++)
     {
         var mage = mageFactory.CreateMage(i, _mageList[i]);
         _mageObjectList.Add(mage);
     }
 }
示例#3
0
 public void InitializeMageDataArrayForStartup(MageFactory mageFactory)
 {
     for (var i = 0; i < 1; i++)
     {
         var mage = mageFactory.CreateMageData(this._element);
         mage.SetState(MageState.Idle);
         _mageList.Add(mage);
     }
 }
示例#4
0
        public Hero CreateHero(string name, RaceType race, HeroType selectedHeroType)
        {
            HeroFactory heroFactory;

            switch (selectedHeroType)
            {
            case HeroType.DeathKnight:
                heroFactory = new DeathKnightFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Hunter:
                heroFactory = new HunterFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Mage:
                heroFactory = new MageFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Monk:
                heroFactory = new MonkFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Paladin:
                heroFactory = new PaladinFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Priest:
                heroFactory = new PriestFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Rogue:
                heroFactory = new RogueFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Warlock:
                heroFactory = new WarlockFactory();
                return(heroFactory.CreateHero(name, race));

            case HeroType.Warrior:
                heroFactory = new WarriorFactory();
                return(heroFactory.CreateHero(name, race));

            default:
                return(null);
            }
        }
示例#5
0
        public Mage RecreateMage(int id, MageFactory mageFactory, MageAssignableBuilding[] allAssignableBuildings)
        {
            var mage    = mageFactory.CreateMage(id, _mageList[id]);
            var oldMage = _mageObjectList[id];

            mage.CopyAutoUpgradeTimers(oldMage);
            GameObject.Destroy(oldMage.gameObject);

            _mageObjectList.RemoveAt(id);
            _mageObjectList.Insert(id, mage);
            var buildingId = mage.Data.GetBuildingId();

            if (buildingId != null)
            {
                allAssignableBuildings[buildingId.Value].EjectMageInside();
                mage.PutIntoBuilding(allAssignableBuildings[buildingId.Value]);
            }
            return(mage);
        }
示例#6
0
        public void Initialize(Player player)
        {
            originalSize = this.transform.localScale;
            Player       = player;
            if (Data == null)
            {
                var randomElement = MageFactory.GetRandomElement();
                Data = new MageData(MageFactory.GetRandomName(), MageFactory.GetRandomLine(), randomElement, Player.GetElementBonus(randomElement));
                Data.SetState(MageState.Idle);
            }
            _isCalling    = false;
            CooldownStart = -100;
            _animator     = GetComponent <Animator>();
            _basePosition = transform.position;
            _baseRotation = transform.rotation;
            StartCoroutine(GenerateCurrency());

            _isHighlightOn = false;
            StartAnimation();
            Data.UpdateDps();
            enabled = true;
        }