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); }
public void TurnOffCollision() { foreach (GameObject Ennemies in currentCollisions) { if (Ennemies) { Ennemies.GetComponent <Enemy0>().OnUnlit(this.transform.parent.gameObject); } } currentCollisions.Clear(); }
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); } } }
/// <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); }
// Use this for initialization void Start() { ennemies = ennemies.GetComponent <Ennemies>(); SetAlcoveNumber(); Spawn(alcoveNumber); }
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)); }