Beispiel #1
0
        public Stage(LayeredTileMap map)
        {
            sCollision = new TileShapeCollection();
            cCollision = new TileShapeCollection();


            var tilesWithCollision = map.TileProperties
                                     .Where(item => item.Value.Any(property => property.Name == "HasCollision" && String.Equals((string)property.Value, "true", StringComparison.OrdinalIgnoreCase)))
                                     .Where(item => item.Value.Any(property => property.Name == "Is Cloud" && !String.Equals((string)property.Value, "true", StringComparison.OrdinalIgnoreCase) ||
                                                                   item.Value.All(property2 => property2.Name != "Is Cloud")))
                                     .Select(item => item.Key).ToList();

            var tilesWithCloudCollision = map.TileProperties
                                          .Where(item => item.Value.Any(property => property.Name == "HasCollision" && String.Equals((string)property.Value, "true", StringComparison.OrdinalIgnoreCase)))
                                          .Where(item => item.Value.Any(property => property.Name == "Is Cloud" && String.Equals((string)property.Value, "true", StringComparison.OrdinalIgnoreCase)))
                                          .Select(item => item.Key).ToList();

            sCollision.AddCollisionFrom(map, tilesWithCollision);
            cCollision.AddCollisionFrom(map, tilesWithCloudCollision);

            sCollision.Visible = false;
            cCollision.Visible = false;
        }
Beispiel #2
0
        private void AddCollisions()
        {
            collisionCollection         = new TileShapeCollection();
            collisionCollection.Visible = true;
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass1");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass2");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass3");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass4");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass5");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass6");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass7");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass8");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass9");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass10");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass11");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Grass12");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock1");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock2");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock3");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock4");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock5");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock6");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock7");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Rock8");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank1");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank2");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank3");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank4");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank5");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "WoodPlank6");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree1");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree2");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree3");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree4");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree5");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree6");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree7");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree8");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree9");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree10");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree11");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree12");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree13");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree14");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree15");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree16");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree17");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree18");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree19");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree20");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree21");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree22");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree23");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree24");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree25");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree26");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree27");
            collisionCollection.AddCollisionFrom(PlatformerLevel1, "Tree28");

            climbableCollection         = new TileShapeCollection();
            climbableCollection.Visible = true;
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine1");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine2");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine3");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine4");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine5");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine6");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine7");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine8");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine9");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine10");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine11");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine12");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine13");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine14");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine15");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine16");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine17");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine18");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine19");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine20");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine21");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine22");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine23");
            climbableCollection.AddCollisionFrom(PlatformerLevel1, "Vine24");

            damagingCollection = new TileShapeCollection();
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike1");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike2");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike3");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike4");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike5");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike6");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike7");
            damagingCollection.AddCollisionFrom(PlatformerLevel1, "Spike8");
        }