Пример #1
0
        public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property)
        {
            _bullet      = property as Bullet;
            _bullet.Name = "SPB_Jakiro_Ice_Path";

            _map     = map;
            _unit    = _bullet.UnitUsed;
            Duration = _bullet.Duration;
            ///Ячейка где действует тучка
            _oldCall = map.Calls.Single(p => p.IndexLeft == _bullet.PositionX &&
                                        p.IndexTop == _bullet.PositionY);
            _oldCall.Bullet.Add(_bullet);

            for (int i = 0; i < _oldCall.IUnits.Count; i++)
            {
                var item = _oldCall.IUnits[i];
                if (item != null && item.GroupType != _unit.GroupType)
                {
                    UnitGenerator.AddStuneTwo(_oldCall, _bullet, _bullet.StunDuration, 4);
                }
            }

            ///Таймер время жизни тучки
            _firstTimer = new Storyboard()
            {
                Duration = TimeSpan.FromSeconds(1)
            };
            _firstTimer.Completed += _firstTimer_Completed;
            _firstTimer.Begin();

            if (Paused)
            {
                Pause();
            }
        }
Пример #2
0
 // Use this for initialization
 protected override void Awake()
 {
     base.Awake();
     uGen            = Camera.main.GetComponent <UnitGenerator> ();
     nextStealthTime = -10f;
     stealthed       = false;
 }
Пример #3
0
        public static Unit Solve(List <Manufacture> manufactures)
        {
            manufactures = ProbabilityComputerer.Compute(manufactures);

            var population = UnitGenerator.GenerateMany(manufactures, POPULATION_SIZE);


            var newPopulation            = IncubationNewUnit.CreateNewPopulation(population);
            int timeWhenDifferenceIsZero = 0;

            while (timeWhenDifferenceIsZero < TIMES_DIFF_ZERO)
            {
                population    = newPopulation;
                newPopulation = IncubationNewUnit.CreateNewPopulation(population);
                if (DifferenceBetweenPopulation(population, newPopulation) == 0)
                {
                    timeWhenDifferenceIsZero++;
                }
                else
                {
                    timeWhenDifferenceIsZero = 0;
                }
            }
            return(newPopulation.OrderBy(u => u.Adaptability).FirstOrDefault());
        }
Пример #4
0
 void _firstTimer_Completed(object sender, object e)
 {
     if (Duration-- >= 0)
     {
         for (int i = 0; i < _oldCall.IUnits.Count; i++)
         {
             var item = _oldCall.IUnits[i];
             if (item != null && item.GroupType != _unit.GroupType)
             {
                 UnitGenerator.AddStuneTwo(_oldCall, _bullet, _bullet.StunDuration, 4);
             }
         }
         _firstTimer.Begin();
     }
     else
     {
         _firstTimer.Completed -= _firstTimer_Completed;
         _firstTimer            = null;
         ///Удаление тучки
         (_bullet.GameObject.View as IGameControl).Remove(_map.MapCanvas);
         ///Удаляем из масива всех объектов
         _map.GameObjectInCall.Remove(_bullet.GameObject);
         _oldCall.Bullet.Remove(_bullet);
     }
 }
Пример #5
0
        /// <summary>
        /// Счастливая монетка, пасивная способновть
        /// </summary>
        public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property)
        {
            bool upSpell = UnitGenerator.UpPlayerSpell(unit, this);

            _unit = unit;

            if (upSpell && !CuldaunBool)
            {
                CuldaunBool = true;
                ///Данная способность является бафом для игрока, в этом случае алхимика

                Buff buff = unit.Buffs.FirstOrDefault(p => p.Name == "GreevilsGreed");
                if (buff != null)
                {
                    buff.GoldBonus = LevelCast * 2;
                }
                else
                {
                    Buff alchBuff = new Buff()
                    {
                        Passive   = true,
                        GoldBonus = LevelCast * 2,
                        Duration  = LevelCast,
                        Name      = "GreevilsGreed"
                    };
                    unit.Buffs.Add(alchBuff);
                }

                UnitGenerator.UpdatePlayerView(unit);
            }
        }
Пример #6
0
 private void Exept()
 {
     //!_exept
     if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY))
     {
         ///Получим ячейку куда попала пуля
         var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY);
         if (!call.Block)
         {
             if (call.IUnits.Any(p => p.GameObject.EnumCallType == EnumCallType.UnitBlock))
             {
                 _bullet.Exept = true;
             }
             else
             {
                 if (!_bullet.Exept)
                 {
                     _bullet.Exept = UnitGenerator.AddDamage(call, _bullet);
                 }
                 else
                 {
                     UnitGenerator.AddDamage(call, _bullet);
                 }
             }
         }
         else
         {
             _bullet.Exept = true;
         }
     }
     else
     {
         _bullet.Exept = true;
     }
 }
Пример #7
0
        public Player ReturnHero()
        {
            Player retPlayer = null;

            if (_selectHero != -1)
            {
                switch (_selectHero)
                {
                case 0: retPlayer = UnitGenerator.Player_Alchemist("Alchemist", 2, null); break;

                case 1: retPlayer = UnitGenerator.Player_Bonik("Fire Bonik", 1, null); break;

                case 2: retPlayer = UnitGenerator.Player_Sniper("Sniper", 3, null); break;

                case 3: retPlayer = UnitGenerator.Player_Jakiro("Jakiro", 4, null); break;

                case 4: retPlayer = UnitGenerator.Player_Mirana("Mirana", 5, null); break;

                case 5: retPlayer = UnitGenerator.Player_Jinx("Jinx", 6, null); break;

                case 6: retPlayer = UnitGenerator.Player_Nature("Nature", 7, null); break;

                case 7: retPlayer = UnitGenerator.Player_Sf("Sf", 8, null); break;
                }
            }

            return(retPlayer);
        }
Пример #8
0
 private void Exept()
 {
     //!_exept
     if (_map.Calls.Any(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY))
     {
         ///Получим ячейку куда попала пуля
         var call = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX && p.IndexTop == _bullet.PositionY);
         if (!call.Block)
         {
             if (!_bullet.Exept)
             {
                 _bullet.Exept = UnitGenerator.AddNullDemage(call, _bullet);
             }
             else
             {
                 UnitGenerator.AddNullDemage(call, _bullet);
             }
         }
         //else
         //    _bullet.Exept = true;
     }
     else
     {
         _bullet.Exept = true;
     }
 }
Пример #9
0
    public UnitDescription ToDescription()
    {
        Enum.TryParse(unitRace, out Race race);
        RaceStat raceStatFound = null;

        foreach (RaceStat raceStat in UnitGenerator.GetAllRaces())
        {
            if (raceStat.race == race)
            {
                raceStatFound = raceStat;
            }
        }

        Enum.TryParse(unitClass, out Class @class);
        ClassStat classStatFound = null;

        foreach (ClassStat classStat in UnitGenerator.GetAllClasses())
        {
            if (classStat.clas == @class)
            {
                classStatFound = classStat;
            }
        }

        return(new UnitDescription(name, raceStatFound, classStatFound, abilityName, Unit.allyTag, id, experience, level, gems));
    }
Пример #10
0
        private void CreateCoopDroppedItems()
        {
            List <ItemClass> droppedItemList = new List <ItemClass>();

            /// 3 кларити
            droppedItemList.Add(UnitGenerator.IBonus2_Clarity());
            droppedItemList.Add(UnitGenerator.IBonus2_Clarity());
            droppedItemList.Add(UnitGenerator.IBonus2_Clarity());
            /// 3 танго
            droppedItemList.Add(UnitGenerator.IBonus4_Tango());
            droppedItemList.Add(UnitGenerator.IBonus4_Tango());
            droppedItemList.Add(UnitGenerator.IBonus4_Tango());
            /// 2 хилинга
            droppedItemList.Add(UnitGenerator.IBonus3_HealingSalve());
            droppedItemList.Add(UnitGenerator.IBonus3_HealingSalve());
            /// 3 лавок
            //   droppedItemList.Add(UnitGenerator.IBonus1_Shop());
            //    droppedItemList.Add(UnitGenerator.IBonus1_Shop());
            //     droppedItemList.Add(UnitGenerator.IBonus1_Shop());

            for (int i = 0; i < droppedItemList.Count; i++)
            {
                Random          rand = new Random(i);
                List <Map_Cell> call = Calls.Where(p => p.IUnits.Any(k => k.GameObject.EnumCallType == EnumCallType.UnitBlock)).ToList();
                call[rand.Next(0, call.Count - 1)].IUnits.Single((k => k.GameObject.EnumCallType == EnumCallType.UnitBlock)).NItem = droppedItemList[i];
            }
        }
Пример #11
0
        /// <summary>
        /// Ульт алхимика, усиливает героя
        /// </summary>
        public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property)
        {
            bool upSpell = UnitGenerator.UpPlayerSpell(unit, this);

            _unit = unit as Player;
            if (unit.UnitFrozen == false &&
                !_culdaunBool && LevelCast != 0 && !upSpell &&
                !unit.Silenced &&
                !unit.Hexed &&
                _unit != null)
            {
                if (unit.Mana >= ManaCost)
                ///Проверка есть ли мана на каст
                {
                    ///Флаг кулдауна
                    _culdaunBool = true;

                    ///Отнимаем нужное количество
                    unit.Mana -= ManaCost;

                    _unit.Invisibility            = true;
                    _unit.GameObject.View.Opacity = 0.25;
                    if (!_unit.Buffs.Any(p => p.Name == "SP_Mirana_MoonlightShadow"))
                    {
                        Buff alchBuff = new Buff()
                        {
                            Duration = Duration,
                            Name     = "SP_Mirana_MoonlightShadow"
                        };
                        _unit.Buffs.Add(alchBuff);
                    }

                    _firstTimer = new Storyboard()
                    {
                        Duration = TimeSpan.FromSeconds(Duration)
                    };
                    _firstTimer.Completed += mouveTimer_Tick;
                    _firstTimer.Begin();

                    _secondTimer = new Storyboard()
                    {
                        Duration = TimeSpan.FromSeconds(Culdaun)
                    };
                    _secondTimer.Completed += mouveTimerCuldaun_Tick;
                    _secondTimer.Begin();

                    if (Paused)
                    {
                        Pause();
                    }

                    if (StartUseSpell != null)
                    {
                        StartUseSpell(this, null);
                    }
                    UnitGenerator.UpdatePlayerView(unit);
                }
            }
        }
Пример #12
0
 //현재 활성화된 Generator를 비활성화시키고 특정 Generator를 받아 활성화
 public void setGenActive(UnitGenerator genToActive)
 {
     if (activeGen)
     {
         activeGen.isActive = false;
     }
     activeGen = genToActive;
 }
Пример #13
0
        /// <summary>
        /// Создает на карте мобов монетки
        /// которые если видят идут атаковать игроков
        /// </summary>
        /// <param name="mopStep">Шаг появления мобов</param>
        public static void CreateMobsCoopEasyMob_Random(Map map, int mopStep, EMobType mobType)
        {
            #region CreateMobs
            int randInt = 0;

            foreach (var item in map.Calls)
            {
                ///Проверка ячеек которые не могут быть заполнены
                if (!item.Used &&
                    !item.Block)
                {
                    Random random = new Random((int)DateTime.Now.Ticks + randInt++);
                    int    rand   = random.Next(0, 100);

                    if (rand < mopStep)
                    {
                        Unit unit;

                        if (mobType == EMobType.RangeBall)
                        {
                            unit    = UnitGenerator.M1_BallRange(item.IndexLeft, item.IndexTop, map);
                            unit.AI = new AI_CoopAiRange()
                            {
                                CurrentMap = map, CurrentUnit = unit
                            };
                        }
                        else
                        {
                            unit    = UnitGenerator.M1_Ball(item.IndexLeft, item.IndexTop, map);
                            unit.AI = new AI_CoopAi()
                            {
                                CurrentMap = map, CurrentUnit = unit
                            };
                        }

                        unit.MaxHealth = unit.MaxHealth * map.CoopTimer;
                        unit.Health    = unit.Health * map.CoopTimer;

                        if (map.CoopTimer != 1)
                        {
                            unit.Demage = unit.Demage * map.CoopTimer / 2;
                        }

                        ///И его же добавим в масив всех объектов
                        map.GameObjectInCall.Add(unit.GameObject);
                        ///Добавляем в список всех юнитов
                        item.IUnits.Add(unit);
                        item.Used = true;
                        unit.AI.StartAI();

                        ///Отображение
                        map.MapCanvas.Children.Add(unit.GameObject.View);
                    }
                }
            }
            #endregion
        }
Пример #14
0
        /// <summary>
        /// Первый уровень кампании
        /// </summary>
        public static void Level_1_Green(Map map)
        {
            #region CreateMobs
            List <int> unitIndex1 = new List <int>()
            {
                19, 23, 32, 33, 34, 35, 36, 49, 58, 62, 71, 73, 75, 84, 85, 86, 87, 88, 110, 111, 112, 125, 136, 137, 138, 139, 140, 162, 163, 164, 166, 175, 177, 179, 188, 190, 191, 192,
            };

            foreach (var item in unitIndex1)
            {
                Unit block1 = UnitGenerator.GrassBlock(map.Calls[item].IndexLeft, map.Calls[item].IndexTop);
                map.CreateObjectUnitInCall(map.Calls[item], block1);
            }

            //for (int i = 0; i < mopCount; i++)
            //{



            //    ///Свободные ячейки
            //    List<Map_Cell> call = map.Calls.Where(p => !p.Used &&
            //         !p.Block).ToList();

            //    Random random = new Random((int)DateTime.Now.Ticks + randInt++);
            //    int rand = random.Next(0, call.Count);

            //    Unit unit;
            //    if (mobType == EMobType.RangeBall)
            //    {
            //        unit = UnitGenerator.M1_BallRange(call[rand].IndexLeft, call[rand].IndexTop, map);
            //        unit.AI = new AI_CoopAiRange() { CurrentMap = map, CurrentUnit = unit };
            //    }
            //    else
            //    {
            //        unit = UnitGenerator.M1_Ball(call[rand].IndexLeft, call[rand].IndexTop, map);
            //        unit.AI = new AI_CoopAi() { CurrentMap = map, CurrentUnit = unit };
            //    }

            //    unit.MaxHealth = unit.MaxHealth * map.CoopTimer;
            //    unit.Health = unit.Health * map.CoopTimer;
            //    unit.Demage = unit.Demage * map.CoopTimer / 2;

            //    ///И его же добавим в масив всех объектов
            //    map.GameObjectInCall.Add(unit.GameObject);
            //    ///Добавляем в список всех юнитов
            //    call[rand].IUnits.Add(unit);
            //    call[rand].Used = true;
            //    unit.AI.StartAI();

            //    ///Отображение
            //    map.MapCanvas.Children.Add(unit.GameObject.View);

            //}

            #endregion
        }
Пример #15
0
    public void OnClick()
    {
        UnitGenerator activeGen = GameController.GetInstance().getActiveGen();

        if (activeGen)
        {
            activeGen.pushGenUnit(num);
            UIManager.GetInstance().setUnitNumText();
        }
    }
Пример #16
0
 private static void CreateBlock(Map map, int mod, List <int> unitIndex1)
 {
     foreach (var item in unitIndex1)
     {
         Unit block1 = UnitGenerator.GrassBlock(map.Calls[item].IndexLeft, map.Calls[item].IndexTop);
         block1.NExp  *= mod;
         block1.NGold *= mod;
         map.CreateObjectUnitInCall(map.Calls[item], block1);
     }
 }
Пример #17
0
        private void mouveTimer_Tick(object sender, object e)
        {
            _firstTimer.Completed -= mouveTimer_Tick;
            _firstTimer            = null;

            _unit.Invisibility            = false;
            _unit.GameObject.View.Opacity = 1;

            UnitGenerator.UpdatePlayerView(_unit);
        }
Пример #18
0
        public static Unit FindMostFrequance(List <Manufacture> manufactures, int maxCount, int partCount)
        {
            if (maxCount < 0)
            {
                throw new ArgumentException("MaxCount must be more then 0");
            }
            if (partCount < 0 || partCount > maxCount)
            {
                throw new ArgumentException("PartCount must be more then 0 and less then MaxCount");
            }

            List <Unit> setOfUnits = UnitGenerator.GenerateMany(manufactures, maxCount);
            Unit        result     = new Unit();

            result.Organisated = new Dictionary <Manufacture, int>(setOfUnits[0].Organisated);

            ///set is organisated to 0
            ///clear values
            foreach (var key in result.Organisated.Keys.ToList())
            {
                result.Organisated[key] = 0;
            }


            setOfUnits = setOfUnits.OrderBy(u => u.Adaptability).ToList();
            setOfUnits = setOfUnits.Take(partCount).ToList();


            Dictionary <Manufacture, int> frequancyOfManufactureInSet = new Dictionary <Manufacture, int>(result.Organisated);

            foreach (var unit in setOfUnits)
            {
                foreach (var manufacture in unit.Organisated)
                {
                    frequancyOfManufactureInSet[manufacture.Key] += manufacture.Value;
                }
            }

            var sortedFrequancy = frequancyOfManufactureInSet.OrderByDescending(m => m.Value);

            foreach (var manufacture in sortedFrequancy)
            {
                if (!result.IsUnitSurvive())
                {
                    result.Organisated[manufacture.Key] = 1;
                }
                else
                {
                    break;
                }
            }

            return(result);
        }
Пример #19
0
        void _firstTimer_Completed(object sender, object e)
        {
            _firstTimer.Completed -= _firstTimer_Completed;
            _firstTimer            = null;

            if (_player != null)
            {
                (_player.GameObject.View as UC_Player).ShowEffect(3, false);
            }

            if (!_unit.Dead &&
                _activeCall != null &&
                !_unit.Silenced &&
                !_unit.Hexed)
            {
                string animationType = "(Canvas.Left)";
                double mouvePos      = 0;
                ///Новая позиция
                double newPos = 0;

                if (_unit.Angel == EAngel.Left || _unit.Angel == EAngel.Right)
                {
                    animationType = "(Canvas.Left)";
                    mouvePos      = Canvas.GetLeft(_unit.GameObject.View);
                    newPos        = _activeCall.IndexLeft;
                }
                else
                {
                    animationType = "(Canvas.Top)";
                    mouvePos      = Canvas.GetTop(_unit.GameObject.View);
                    newPos        = _activeCall.IndexTop;
                }

                _storyboard = new Storyboard();
                var animation = new DoubleAnimation
                {
                    From     = mouvePos,
                    To       = newPos * 50,
                    Duration = TimeSpan.FromSeconds(0.3)
                };
                _storyboard.Children.Add(animation);
                Storyboard.SetTargetProperty(animation, animationType);
                Storyboard.SetTarget(_storyboard, _unit.GameObject.View);
                _storyboard.Completed += _storyboard_Completed;
                _storyboard.Begin();
            }
            else
            {
                _unit.UnitFrozen = false;
            }


            UnitGenerator.UpdatePlayerView(_unit);
        }
Пример #20
0
 private void fillUnitsFromArmies(ref List <IUnit> units, IArmy fromArmy)
 {
     foreach (var unit in fromArmy.Units)
     {
         IUnit newUnit = UnitGenerator.generateUnit(unit.GetType());
         newUnit.Health  = unit.Health;
         newUnit.Defence = unit.Defence;
         newUnit.Attack  = unit.Attack;
         units.Add(newUnit);
     }
 }
Пример #21
0
        public void Initialize()
        {
            RandomDataGenerator random = new RandomDataGenerator();
            UnitGenerator       unit   = new UnitGenerator();

            Weeks             = unit.GetWeeks(6);
            PhotosTakenByTime = random.GetRandomDatapoint(6, 20, 100);

            Days = unit.GetDays(10);
            SuccessfulPhotosTaken = random.GetRandomDatapoint(10, 1, 100);
            FailedPhotosTaken     = random.GetRandomDatapoint(10, 1, 100);
        }
Пример #22
0
        void _firstTimer_Completed(object sender, object e)
        {
            _firstTimer.Completed -= _firstTimer_Completed;
            _firstTimer            = null;

            Map_Cell oldCall = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX &&
                                                 p.IndexTop == _bullet.PositionY);

            oldCall.Bullet.Remove(_bullet);
            /////Сначала проверяем старую ячейку на попадение
            //Exept();
            _bullet.PositionX = _xNew;
            _bullet.PositionY = _yNew;
            Exept();



            ///Проверяем или молния попала
            if (_bullet.Exept == true)
            {
                _hitCount--;
            }

            Map_Cell newCall = _map.Calls.FirstOrDefault(p => p.IndexLeft == _bullet.PositionX &&
                                                         p.IndexTop == _bullet.PositionY);

            /// Если есть аганим
            if (Name == "SP_Nature_Wrath" && UnitGenerator.HasAghanim(_unit) &&
                _bullet.RemoveUnit != null)
            {
                CreateTrent(newCall, _bullet.RemoveUnit);
            }

            if (_hitCount == 0 || newCall == null ||
                ///Или новая ячейка блок
                newCall != null && newCall.Block)
            {
                (_bullet.GameObject.View as IGameControl).Remove(_map.MapCanvas);
                ///Было попадение, анимация исчезновения стрелы
                //_bullet.GameObject.View.Visibility = Visibility.Collapsed;
                ///Было попадение стрела исчезает
                ///Удаляем из масива всех объектов
                _map.GameObjectInCall.Remove(_bullet.GameObject);
                _exept = true;

                //_map.MapCanvas.Children.Remove(_bullet.GameObject.View);
            }
            else
            {
                newCall.Bullet.Add(_bullet);
            }
        }
Пример #23
0
 /// <summary>
 /// 건물에 유닛 소환기능이 있을경우 사용, unitGenerator 반드시 초기화 할것.
 /// </summary>
 /// <param name="index">건물의 인덱스(위치)</param>
 /// <param name="targetPos">건물의 대상 지점</param>
 /// <param name="genPos"> 유닛이 소환될 지점 위치</param>
 public void Initiallize(byte playerIndex, short buildingIndex, Vector3 targetPos, Vector3 genPos)
 {
     OnIitiallize(playerIndex, buildingIndex);
     nowWorking                = false;
     this.playerIndex          = playerIndex;
     this.buildingindex        = buildingIndex;
     this.targetPoint.position = targetPos;
     unitGenerator             = gameObject.GetComponent <UnitGenerator>();
     unitGenerator.Initiallize(3, this.transform.position);
     level    = 1;
     maxLevel = 3;
     Debug.Log("Building Initialized");
 }
Пример #24
0
        void _firstTimer_Completed(object sender, object e)
        {
            _firstTimer.Completed -= _firstTimer_Completed;
            _firstTimer            = null;


            _unit.OrijSpeed += _bonusSpeed;

            ///Бонусная скорость атаки
            _unit.OrijAttackSpeed += _bonusAttackSpeed;

            UnitGenerator.UpdatePlayerView(_unit);
        }
Пример #25
0
        void mouveTimer_Tick(object sender, object e)
        {
            if (_player != null)
            {
                (_player.GameObject.View as UC_Player).ShowEffect(4, false);
            }

            _firstTimer.Completed -= mouveTimer_Tick;
            _firstTimer            = null;
            _unit.DemageItem      -= _adddDamage;
            _unit.OrijHealth       = _oldMaxHelth;

            UnitGenerator.UpdatePlayerView(_unit);
        }
Пример #26
0
    public void Init(GameObject tower)
    {
        // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>();
        // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300);
        // GetComponent<Canvas> ().enabled = true;

        castle = GameObject.Find("Castle").GetComponent <CastleHealth>();
        uGen   = Camera.main.GetComponent <UnitGenerator>();
        cFire  = tower.transform.FindChild("Turret").GetComponent <CannonFire>();

        // pause game
        previousTimeScale = Time.timeScale;
        Time.timeScale    = 0;
    }
Пример #27
0
        void _firstTimer_Completed(object sender, object e)
        {
            _power++;
            _firstTimer.Completed -= _firstTimer_Completed;
            _firstTimer            = null;

            if (_power == 2 ||
                _power == 4 ||
                _power == 6 ||
                _power == 8)
            {
                _bullet.DemageMagic += _bullet.BonusDemage;
                _bullet.Speed       -= 0.06;
            }

            Map_Cell oldCall = _map.Calls.Single(p => p.IndexLeft == _bullet.PositionX &&
                                                 p.IndexTop == _bullet.PositionY);

            oldCall.Bullet.Remove(_bullet);
            /////Сначала проверяем старую ячейку на попадение
            //Exept();
            _bullet.PositionX = _xNew;
            _bullet.PositionY = _yNew;
            Exept();

            Map_Cell newCall = _map.Calls.FirstOrDefault(p => p.IndexLeft == _bullet.PositionX &&
                                                         p.IndexTop == _bullet.PositionY);

            if (_bullet.Exept == true)
            {
                if (newCall != null && !newCall.Block)
                {
                    UnitGenerator.AddStune(newCall, _bullet, _bullet.StunDuration);
                }

                (_bullet.GameObject.View as IGameControl).Remove(_map.MapCanvas);
                ///Было попадение, анимация исчезновения стрелы
                //_bullet.GameObject.View.Visibility = Visibility.Collapsed;
                ///Было попадение стрела исчезает
                ///Удаляем из масива всех объектов
                _map.GameObjectInCall.Remove(_bullet.GameObject);

                BoomMethod(_bullet.PositionX, _bullet.PositionY);
                //_map.MapCanvas.Children.Remove(_bullet.GameObject.View);
            }
            else
            {
                newCall.Bullet.Add(_bullet);
            }
        }
Пример #28
0
        public void UseSpall(Map map, Game_Object_In_Call obj, IUnit unit, object property)
        {
            _unit = unit;

            if (unit.UnitFrozen == false &&
                !_culdaunBool && !_unit.Hexed)
            {
                if (unit.Mana >= ManaCost)
                ///Проверка есть ли мана на каст
                {
                    ///Флаг кулдауна
                    _culdaunBool  = true;
                    _spellStopped = false;

                    ///Отнимаем нужное количество
                    unit.Mana -= ManaCost;
                    _unit      = unit;



                    unit.OrijSpeed -= _speed;


                    _firstTimer = new Storyboard()
                    {
                        Duration = TimeSpan.FromSeconds(Duration)
                    };
                    _firstTimer.Completed += mouveTimer_Tick;
                    _firstTimer.Begin();

                    _secondTimer = new Storyboard()
                    {
                        Duration = TimeSpan.FromSeconds(Culdaun)
                    };
                    _secondTimer.Completed += mouveTimerCuldaun_Tick;
                    _secondTimer.Begin();

                    if (Paused)
                    {
                        Pause();
                    }

                    if (StartUseSpell != null)
                    {
                        StartUseSpell(this, null);
                    }
                    UnitGenerator.UpdatePlayerView(unit);
                }
            }
        }
Пример #29
0
    private void AddRandomUnit()
    {
        UnitDescription newUnit     = null;
        bool            createdUnit = false;

        while (!createdUnit) //Unsafe, must have at most as many slots than possible combinations
        {
            newUnit = UnitGenerator.GenerateUnit(Unit.allyTag);
            if (GetEquivalentUnit(newUnit) == null)
            {
                createdUnit = true;
            }
        }
        AddUnitInInventory(newUnit);
    }
Пример #30
0
 private static void CreateMobs(Map map, int mod, List <int> unitIndex3)
 {
     foreach (var item in unitIndex3)
     {
         Unit mob1 = UnitGenerator.M1_Ball(map.Calls[item].IndexLeft, map.Calls[item].IndexTop, map);
         mob1.NExp  *= mod;
         mob1.NGold *= mod;
         mob1.AI     = new AI_EasyAi()
         {
             CurrentMap = map, CurrentUnit = mob1
         };
         mob1.AI.StartAI();
         map.CreateObjectUnitInCall(map.Calls[item], mob1);
     }
 }
Пример #31
0
 // Use this for initialization
 protected override void Awake()
 {
     base.Awake ();
     timeOfLastSpawn = Time.time;
     numBodiesSpawned = 1;
     keepSpawning = true;
     uGen = Camera.main.GetComponent<UnitGenerator> ();
     GameObject go = GameObject.Find ("Spawn");
     if (go) {
         spawn = go.transform.position;
     } else {
         Debug.Log ("Spawn not found");
     }
     bodyAndTail = new List<UnitAnimated> ();
 }
 // Use this for initialization
 void Awake()
 {
     Time.timeScale = 1f;
     isRunningLevel = false;
     level = 1;
     uGen = Camera.main.GetComponent<UnitGenerator> ();
     GameObject go = GameObject.Find ("Spawn");
     if (go) {
         spawn = go.transform.position;
     } else {
         Debug.Log ("Spawn not found");
     }
     //Makes it so the noise is 0.25 at level 50.
     noiseScalingScalar = 0.25f / Mathf.Pow (50f, noiseScalingFactor);
 }
Пример #33
0
    // Use this for initialization
    void Start()
    {
        numSpawned = 0;
        uGen = Camera.main.GetComponent<UnitGenerator> ();

        //		lvlSpawn = Camera.main.GetComponent<LevelSpawner> ();
        //		lvlSpawn.StartNextLevel ();
        //		InvokeRepeating("SpawnNext", 0, interval);

        //				SpawnNext ();

        //		node = NeuralNode.create (NeuralNode.NodeType.GRAYSCALE);
        //		node = ScriptableObject.CreateInstance<CombinationNode> ();
        //		NeuralNode gray = NeuralNode.create (NeuralNode.NodeType.GRAYSCALE);
        //		NeuralNode color = NeuralNode.create (NeuralNode.NodeType.COLORHIST);
        //		node.AddSubNode (gray);
        //		node.AddSubNode (color);
    }
Пример #34
0
    public void Init(GameObject tower)
    {
        // ShowTowerPopup window = ScriptableObject.CreateInstance<ShowTowerPopup>();
        // window.position = new Rect(Screen.width / 2 + 100, Screen.height / 2 - 50, 300, 300);
        // GetComponent<Canvas> ().enabled = true;

        castle = GameObject.Find("Castle").GetComponent<CastleHealth>();
        uGen = Camera.main.GetComponent<UnitGenerator>();
        cFire = tower.transform.FindChild("Turret").GetComponent<CannonFire>();

        // pause game
        previousTimeScale = Time.timeScale;
        Time.timeScale = 0;
    }
Пример #35
0
    void Start()
    {
        time = 0f;

        unitGenerator = GameObject.FindGameObjectWithTag("Base").GetComponent<UnitGenerator>();
    }