private List<PopulationEntity> findPopList(int x, int y, int area) { var result = new List<PopulationEntity>(); for (int i = 0; i < area; i++) { for (int j = 0; j < area; j++) { var tmpPos = new Position(i + x - area / 2, j + y - area / 2); tmpPos.NormalizePos(mapsize); if (populationMatrix[tmpPos.X, tmpPos.Y].Count > 0) { foreach (PopulationEntity p in populationMatrix[tmpPos.X, tmpPos.Y]) { result.Add(p); } } } } return result; }
private void moveEntity(PopulationEntity pop, Direction dir) { Position p = PositionUtils.GetDirPosition(dir); Position newPos = new Position(pop.Pos.X + p.X, pop.Pos.Y + p.Y); newPos.NormalizePos(mapsize); populationMatrix[pop.Pos.X, pop.Pos.Y].Remove(pop); pop.Pos = newPos; pop.Object.transform.position = new Vector3(newPos.X * tilesize, -newPos.Y * tilesize, 0); pop.LevelObject.transform.position = new Vector3(newPos.X * tilesize, -newPos.Y * tilesize, -1); populationMatrix[newPos.X, newPos.Y].Add(pop); }
public override void apply(BattleEntity self, BattleEntity target, Direction dir, BattleArena arena) { Position newPos = new Position(target.CurrentPos.X + PositionUtils.GetDirPosition(dir).X * Dist, target.CurrentPos.Y + PositionUtils.GetDirPosition(dir).Y * Dist); newPos.NormalizePos(arena.ArenaSize); arena.MoveBattleEntity(target, newPos); }