Ejemplo n.º 1
0
        public FighterEntry GetNearestEnnemy(short cellId = -1, Func <FighterEntry, bool> filter = null)
        {
            MapPoint     charMp = MapPoint.FromCellId(cellId == -1 ? PlayedFighter.CellId : cellId), ennemyMp;
            int          distance = -1, tempDistance;
            FighterEntry ennemy = null;

            foreach (var ennemyEntry in filter == null ? Ennemies : Ennemies.Where(f => filter(f)))
            {
                if (!ennemyEntry.Alive)
                {
                    continue;
                }

                ennemyMp     = MapPoint.FromCellId(ennemyEntry.CellId);
                tempDistance = charMp.DistanceToCell(ennemyMp);

                if (distance == -1 || tempDistance < distance)
                {
                    distance = tempDistance;
                    ennemy   = ennemyEntry;
                }
            }

            return(ennemy);
        }
Ejemplo n.º 2
0
 public void TurnOffCollision()
 {
     foreach (GameObject Ennemies in currentCollisions)
     {
         if (Ennemies)
         {
             Ennemies.GetComponent <Enemy0>().OnUnlit(this.transform.parent.gameObject);
         }
     }
     currentCollisions.Clear();
 }
Ejemplo n.º 3
0
 public void Update(GameFightLeaveMessage message)
 {
     if (PlayedFighter?.ContextualId == message.CharId)
     {
         IsFightStarted = false;
     }
     else
     {
         var fighter = GetFighter(message.CharId);
         _fighters.TryRemove(fighter.ContextualId, out FighterEntry f);
         if (Allies.Contains(fighter))
         {
             _allies.TryRemove(fighter.ContextualId, out FighterEntry a);
         }
         else if (Ennemies.Contains(fighter))
         {
             _ennemies.TryRemove(fighter.ContextualId, out FighterEntry e);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Add the enemy child in the group and link its transform to the group
 /// </summary>
 public void AddChild(Ennemies child)
 {
     child.transform.SetParent(transform);
 }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     ennemies = ennemies.GetComponent <Ennemies>();
     SetAlcoveNumber();
     Spawn(alcoveNumber);
 }
Ejemplo n.º 6
0
        public IEnumerable <FighterEntry> GetHandToHandEnnemies(short cellId = -1)
        {
            MapPoint charMp = MapPoint.FromCellId(cellId == -1 ? PlayedFighter.CellId : cellId);

            return(Ennemies.Where(e => e.Alive && charMp.DistanceToCell(MapPoint.FromCellId(e.CellId)) == 1));
        }