Exemplo n.º 1
0
        private void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            var passiveType = GetPassive(sender.Name);

            if (passiveType != PassiveType.NULL)
            {
                var enemy =
                    HeroManager.Enemies.Where(e => e.IsValidTarget() && e.Distance(sender.Position) < 50)
                    .OrderBy(e => sender.Position.Distance(e.Position))
                    .FirstOrDefault();
                if (enemy == null)
                {
                    return;
                }
                PassiveManager temp         = new PassiveManager(enemy);
                var            alreadyAdded = passives.FirstOrDefault(p => p.Enemy.NetworkId == enemy.NetworkId);
                if (alreadyAdded != null)
                {
                    alreadyAdded.passives.Add(new Passive(passiveType, System.Environment.TickCount));
                    //Console.WriteLine("Updated: " + sender.Name);
                }
                else
                {
                    temp.passives.Add(new Passive(passiveType, System.Environment.TickCount));
                    passives.Add(temp);
                    //Console.WriteLine("NewAdded: " + sender.Name);
                }
            }
        }
Exemplo n.º 2
0
 private void GameObject_OnCreate(GameObject sender, EventArgs args)
 {
     var passiveType = GetPassive(sender.Name);
     if (passiveType != PassiveType.NULL)
     {
         var enemy =
             HeroManager.Enemies.Where(e => e.IsValidTarget() && e.Distance(sender.Position) < 50)
                 .OrderBy(e => sender.Position.Distance(e.Position))
                 .FirstOrDefault();
         if (enemy == null)
         {
             return;
         }
         PassiveManager temp = new PassiveManager(enemy);
         var alreadyAdded = passives.FirstOrDefault(p => p.Enemy.NetworkId == enemy.NetworkId);
         if (alreadyAdded != null)
         {
             alreadyAdded.passives.Add(new Passive(passiveType, System.Environment.TickCount));
             //Console.WriteLine("Updated: " + sender.Name);
         }
         else
         {
             temp.passives.Add(new Passive(passiveType, System.Environment.TickCount));
             passives.Add(temp);
             //Console.WriteLine("NewAdded: " + sender.Name);
         }
     }
 }