private bool AddUnitToMap(Point point, Unit unit) { if (Units.Contains(point)) { Debug.LogError($"[EnvironmentManager] Units map already contains a unit in specified point {unit.name} {unit.GetPosition()}, Conflicting Unit: {Units.Get(point)} {Units.Get(point).GetPosition()}", Units.Get(point)); return(false); } Units.Add(point, unit); return(true); }
private IEnumerator SpawnNeoSatan() { BossFightController.SetActive(true); if (DisableHUD) { MainHUD.SetActive(false); } // APPLY KNOCKBACK TO NEOSATAN SPAWN AREA foreach (Point item in LoadSpawnArea()) { handler.Execute(controller, NeoSatanSpawnPosition, item, 1); } handler.Execute(controller, new Point(this.NeoSatanSpawnPosition.x - 1, this.NeoSatanSpawnPosition.y, this.NeoSatanSpawnPosition.z), NeoSatanSpawnPosition, 1); do { yield return(null); } while (map.Contains(NeoSatanSpawnPosition)); ActivateSoulSphere(); // SPAWN NEO-SATAN NeoSatanReference = AIPlacementHelper.AddUnit(null, NeoSatanSpawnPosition, NeoSatan); BossFightController.GetComponent <BossFightController>().SetNeoSatanRef(NeoSatanReference); OnNeoSatanSpawn?.Invoke(); }
public override List <Point> GetValidTargets(List <Point> board, Point point) { List <Point> boardPoints = base.GetValidTargets(board, point); this.ValidPositions = boardPoints.Where(currentPoint => !map.Contains(currentPoint)).ToList(); return(this.ValidPositions); }
//// TODO use UI to place units private Point GetValidPointToRespawn() { List <Point> board = boardController.GetAllPointsWithNavigationTypeOf(TerrainNavigationType.BOTH); List <Point> excludingEnemies = board.Where(p => !map.Contains(p)).ToList(); int index = random.Next(excludingEnemies.Count); return(excludingEnemies[index]); }
protected override void AttackPositions(Point point) { base.AttackPositions(point); if (!UnitsMap.Contains(point)) { return; } SkillActionFX?.Play(UnitsMap.Get(point).gameObject.transform.position); }
protected virtual void AttackPositions(Point point) { if (!UnitsMap.Contains(point)) { return; } Unit targetUnit = this.UnitsMap.Get(point); KnockbackHandler handler = new KnockbackHandler(this.UnitsMap); handler.Execute(this.BoardController, this.Unit.GetPosition(), targetUnit.GetPosition(), this.Knockback); targetUnit?.Health.ReduceHealth(this.DeltaHealth); }
private void SetSkillAction(SkillAction action, Point target) { ActionPerformed = action; SelectedUnit = action.Unit; SelectedAction = action.ActionType; Instigator = action.Unit; if (map.Contains(target)) { HasTarget = true; Target = map.Get(target); } EvaluateCameraMovement(); }
private IEnumerator ApplyExplosion(Point[] targets, Point[] attackArea) { yield return(new WaitForSeconds(HighlightWaitTime)); foreach (Point item in targets) { if (UnitsMap.Contains(item)) { Unit targetUnit = UnitsMap.Get(item); targetUnit.Health.ReduceHealth(Damage); handler.Execute(controller, this.GetPosition(), targetUnit.GetPosition(), 1); } } controller.SwitchTilesFromActiveBoards(new HashSet <Point>(attackArea), Edu.Vfs.RoboRapture.TileAuxillary.TileStates.NORMAL); EnvironmentManager.EnvironmentCollection.Remove(WorldPosition); UnitsMap.Remove(this.GetPosition()); gameObject.SetActive(false); }
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)); }
// // Summary: // // Called to Cause lightning to apply damage to units. // public IEnumerator CastLightning() { if (LoadedLightningPoints.Count > 0) { foreach (Point item in LoadedLightningPoints) { yield return(new WaitForSeconds(LightningIntervalDelay)); EffectsPostProcessingController.Instance.ApplyEffect(EffectType.ExposureFlash, ExposureDuration, ExposureSpeed, ExposureStrength); OnLightningHit?.Invoke(); LightningStrikeFX.Play(new Vector3(item.x, 1, item.z)); if (units.Contains(item)) { units.Get(item).Health.ReduceHealth(LightningDamage); } Destroy(SpawnedIndicators[item].gameObject); foreach (Tile tile in controller.GetAllTilesFromVisibleBoard()) { if (tile.EntityPosition == item) { tile.SwitchDescription(TileAuxillary.DescriptionTypes.NORMAL); } } } LoadedLightningPoints.Clear(); SpawnedIndicators.Clear(); } else { LoadLightning(); } }
public void Explode() { List <Point> foundTargets = new List <Point>(); // TODO: Query Units Map for all surrounding units. in the cardinal directions foreach (Point item in attackArea) { if (UnitsMap.Contains(item)) { foundTargets.Add(item); } controller.SwitchTilesFromActiveBoards(new HashSet <Point>(attackArea), Edu.Vfs.RoboRapture.TileAuxillary.TileStates.ATTACK); } // TODO: Apply target highlight to surrounding tiles and attack highlight. foreach (Point item in foundTargets) { controller.SwitchTilesFromActiveBoards(new HashSet <Point>(attackArea), Edu.Vfs.RoboRapture.TileAuxillary.TileStates.TARGET); } StartCoroutine(ApplyExplosion(foundTargets.ToArray(), attackArea.ToArray())); }
public bool IsValid() { return(point.x > 1 && point.x < 4 && point.z >= 0 && !map.Contains(point)); }