private void SimulateAttack(bool highlight) { List <Unit> playerUnits = this.UnitsMap.GetUnits(Type.Player); List <Unit> enemyUnits = UnitsMap.GetUnits(Type.Enemy); enemyUnits.ForEach(unit => SimulateAttack(highlight, unit.GetPosition(), 0, -this.Knockback, false)); playerUnits.ForEach(unit => SimulateAttack(highlight, unit.GetPosition(), this.DeltaHealth, -this.Knockback, false)); }
private void PullAll() { KnockbackHandler handler = new KnockbackHandler(this.Unit.UnitsMap); List <Unit> enemyUnits = UnitsMap.GetUnits(Type.Enemy); enemyUnits.AddRange(UnitsMap.GetUnits(Type.Player)); enemyUnits.ForEach(enemyUnit => this.PullUnit(handler, enemyUnit)); }
private void PlayerUnitDefeated(Point position, UnitType unitType) { List <Unit> playerUnits = unitsMap.GetUnits(Type.Player); if (playerUnits.Count == 0) { MusicController.Instance.PlayManual(MusicTypes.LOSE); GameEnded?.Invoke(false); } }
public override void DestroyTerrain() { foreach (Point item in map.GetUnits()) { if (map.Get(item).GetUnitType() == Type.Player) { map.Get(item).Health.IncreaseHealth(HealAmount); } } base.DestroyTerrain(); }
public static KeyValuePair <Point, int> GetClosestTarget(UnitsMap unitsMap, Point unitPosition, int range) { Dictionary <Point, int> playerUnits = new Dictionary <Point, int>(); foreach (var playerUnit in unitsMap.GetUnits(Type.Player)) { int distance = PointUtils.GetDistance(unitPosition, playerUnit.GetPosition()); playerUnits.Add(playerUnit.GetPosition(), distance); } var orderer = playerUnits.OrderByDescending(unit => unit.Value); if (orderer == null || orderer.Count() == 0) { return(default);
public override void StartTurn(EntityTurnManager turnManager) { this.Units = unitsMap.GetUnits(RoboRapture.Units.Type.Enemy); this.CleanSelection(); this.playerController.CleanSelection(); if (this.TurnManager == null) { this.TurnManager = turnManager; } this.enemyTurn.Value++; this.Units.ForEach(item => item.Turn = enemyTurn.Value); this.StartCoroutine(this.SetOrder()); }
private void Update() { if (Input.GetKeyDown(KeyCode.BackQuote)) { tracker.PerformEndroll(); } if (Input.GetKeyDown(KeyCode.Q)) { foreach (Unit item in map.GetUnits(Type.Enemy)) { if (item.GetSpawnedUnitType() == UnitType.NEOSATAN_HEAD) { item.Health.ReduceHealth(item.Health.Data.MaxValue - 1); } } } }
public static Dictionary <Point, List <Point> > GetAllPaths(List <Point> board, UnitsMap unitsMap, Point unitPosition, bool excludePlayerUnits) { if (board == null || unitsMap == null) { return(new Dictionary <Point, List <Point> >()); } int distance = 0; int patternSize = 7; int stepsLimit = 17; List <Point> boardPoints = PatternProcessor.Process(board, new SquarePattern(patternSize), unitPosition, distance); List <Point> processedList = boardPoints.Where(currentPoint => !unitsMap.Contains(currentPoint)).ToList(); if (!excludePlayerUnits) { unitsMap.GetUnits(Type.Player).ForEach(unit => processedList.Add(unit.GetPosition())); } return(BFS.GetPaths(processedList, unitPosition, stepsLimit)); }
private void OnNeoSatanDamaged() { if (NeoSatan == null) { return; } Health NeoSatanHealth = NeoSatan.Health; if (NeoSatanHealth == null) { return; } if (NeoSatanHealth.Data.Value <= NeoSatanHealth.Data.MaxValue / 2) { IncreaseBloodRain(); } if (NeoSatanHealth.Data.Value <= 5f) { SManager.MaxWhelps = 0; } if (NeoSatanHealth.Data.Value <= 0f && !HasSummonedWeakSatan) { foreach (var item in map.GetUnits(Type.Enemy)) { if (item.GetSpawnedUnitType() == UnitType.WHELP) { item.Health.ReduceHealth(item.Health.Data.MaxValue); } } endingSequence.gameObject.SetActive(true); endingSequence.NeoSatan = this.NeoSatan; endingSequence.SpawnWeakenedNeoSatan(); HasSummonedWeakSatan = true; } }