bool CheckForSpellStructuresCollisions(LinearSpell spell, Rect spellRect, TeamStructures enemyStructures) { foreach (IStructure structure in enemyStructures.Structures) { if (structure.Alive && // not a destroyed target enemyStructures.IsDestructible(structure.Type) && // not an indestructible target spell.Info.Kind == SpellKind.OffensiveSkillshot && // offensive spell structure.Rectangle.Intersects(spellRect)) // we hit it { structure.Hurt(spell.Info.Value); // we hurt it return(true); } } return(false); }
public GameMatch(string mapPath) { World = new GameWorld(mapPath); Physics = new PhysicsEngine(World); CurrentState = new MatchState(Physics); LeftStructures = new TeamStructures(Teams.Left, World.Map.Meta.LeftMeta.BaseTileIds, World.Map.Meta.LeftMeta.BaseTowerTileIds, World.Map.Meta.LeftMeta.TopTowerTileIds, World.Map.Meta.LeftMeta.BottomTowerTileIds); RightStructures = new TeamStructures(Teams.Right, World.Map.Meta.RightMeta.BaseTileIds, World.Map.Meta.RightMeta.BaseTowerTileIds, World.Map.Meta.RightMeta.TopTowerTileIds, World.Map.Meta.RightMeta.BottomTowerTileIds); Structures = new List <IStructure>(); LeftStructures.Structures.ForEach(Structures.Add); RightStructures.Structures.ForEach(Structures.Add); }