void setupHumanBase(Vector2 basePos, Faction faction) { float fClear = 5f; var factSurround = new RectPoly(basePos, fClear, fClear, 0f); var acts = world.Query(factSurround); foreach (var actor in acts) { if ((actor is Wall || actor is Resource) && (actor.Type != "Monolith")) { actor.Die(); } } world.AddActor(UnitConverter.CreateActor("Fortress", basePos, faction, true)); world.AddActor(UnitConverter.CreateActor("Troy", basePos - 1.5f * Vector2.One, faction, true)); /*for (int i = 0; i < 3; i++) * { * var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); * world.AddActor(UnitConverter.CreateActor("Miner", pos, faction)); * } * for (int i = 0; i < 10; i++) * { * var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); * world.AddActor(UnitConverter.CreateActor("Ranger", pos, faction)); * } * for (int i = 0; i < 10; i++) * { * var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); * world.AddActor(UnitConverter.CreateActor("Troy", pos, faction)); * }*/ }
public Effects.GraphicsEffect CreateEffect(float rad, Actor targ, float lifeTime) { switch (EffectData.Type) { case "Explosion": return(new Effects.Explosion(Attacker.Position, rad, EffectData.Image)); case "TractorBeam": if (targ == null) { return(null); } return(new Effects.TractorBeam(Attacker, targ, lifeTime, AreaOfAffect.Height, EffectData.Image)); case "RectEffect": RectPoly rect = new RectPoly(Attacker.Position, targ.Position); rect.Rotation = MathHelper.GetAngle(targ.Position - Attacker.Position); rect.Center = (targ.Position + Attacker.Position) / 2; rect.Height = AreaOfAffect.Height; rect.Width = AreaOfAffect.Width; return(new Effects.RectEffect(rect)); default: return(null); } }
IEnumerable <Actor> getUnitsInSelection(Vector2 pos1, Vector2 pos2) { var min = Vector2.Min(pos1, pos2); var max = Vector2.Max(pos1, pos2); RectPoly testPoly = new RectPoly(min, max); return(world.Query(testPoly)); }
void setupBase(Vector2 basePos, PlayerType pType, Faction faction) { /*var factory = UnitConverter.CreateActor("Factory", basePos, faction); * world.AddActor(factory); * * float fClear = 7f; * * var factSurround = new RectPoly(basePos, fClear, fClear, 0f); * var acts = world.Query(factSurround); * foreach (var actor in acts) * { * if (actor is Wall || actor is Resource) * actor.Die(); * } * * * for (int i = 0; i < 10; i++) * { * var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); * world.AddActor(UnitConverter.CreateActor("Troy", pos, faction)); * }*/ float fClear = 7f; var factSurround = new RectPoly(basePos, fClear, fClear, 0f); var acts = world.Query(factSurround); foreach (var actor in acts) { if (actor is Wall || actor is Resource) { actor.Die(); } } if (pType == PlayerType.Human) { foreach (string act in ResourceManager.Resources["Settings"]["StartHumanUnits"]) { var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); world.AddActor(UnitConverter.CreateActor(act, pos, faction)); } } else { foreach (string act in ResourceManager.Resources["Settings"]["StartWumpusUnits"]) { var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); world.AddActor(UnitConverter.CreateActor(act, pos, faction)); } } }
void setupWumpusBase(Vector2 basePos, Faction faction) {//put wumpus targes here var factory = (FatherBuilding)UnitConverter.CreateActor("Spawning Pit", basePos, faction); factory.OnWorkedOn(factory.WorkNeeded); world.AddActor(factory); float fClear = 10f; var factSurround = new RectPoly(basePos, fClear, fClear, 0f); var acts = world.Query(factSurround); foreach (var actor in acts) { if ((actor is Wall || actor is Resource) && (actor.Type != "Monolith")) { actor.Die(); } } for (int i = 0; i < 2; i++) { var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); world.AddActor(UnitConverter.CreateActor("Dark Magus", pos, faction)); } for (int i = 0; i < 10; i++) { var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); world.AddActor(UnitConverter.CreateActor("Tentaclez", pos, faction)); } for (int i = 0; i < 20; i++) { var pos = basePos + Vector2.UnitX * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2) + Vector2.UnitY * ((float)MathHelper.Rand.NextDouble() * 2 - 1f) * (fClear / 2); world.AddActor(UnitConverter.CreateActor("Mite", pos, faction)); } }
public RectEffect(RectPoly r) { rect = r; }