private void AssignTriggers() { foreach (var item in addedGameObjects) { if (item is TopDownTrigger) { triggers.Add((TopDownTrigger)item); } if (item is TopDownTriggerableObject) { triggeredObjs.Add((TopDownTriggerableObject)item); } } triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 1).OnTraversingEmancipationGrill += OnTraversingGrillID1; triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 2).OnTraversingEmancipationGrill += OnTraversingGrillID2; triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 7).OnTraversingEmancipationGrill += OnTraversingGrillID7; triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 9).OnTraversingEmancipationGrill += OnTraversingGrillID9; triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 2).AssignTrigger(triggers.Find(t => t.Name.Contains("Button") && t.ID == 2)); triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 3).AssignTrigger(triggers.Find(t => t.Name.Contains("Button") && t.ID == 1)); triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 5).AssignTrigger(triggers.Find(t => t.Name.Contains("Button") && t.ID == 4)); triggeredObjs.Find(c => c.Name.Contains("Grill") && c.ID == 8).AssignTrigger(triggers.Find(t => t.Name.Contains("Button") && t.ID == 4)); buttonID2 = (TopDownHeavyDutySuperCollidingSuperButton)triggers.Find(t => t.Name.Contains("Button") && t.ID == 2); buttonID3 = (TopDownHeavyDutySuperCollidingSuperButton)triggers.Find(t => t.Name.Contains("Button") && t.ID == 3); victoryTrigger = (VictoryTrigger)triggers.Find(t => t.Name.Contains("VictoryTrigger")); }
public override void LoadContent() { SpriteSheet = GameManager.LoadTexture2D("SpriteSheetSS"); LoadSprites(GameManager.Content.RootDirectory + "/spritesheetSS.xml"); SideScrollMap sideScrollMap = new SideScrollMap("SideScrollMap"); player = new SideScrollPlayer(new Vector2(20, sideScrollMap.Background.Height - 400)); camera = new Camera(player); camera.SetBackgroundResolution(sideScrollMap.Background.Width, sideScrollMap.Background.Height); victoryTrigger = new VictoryTrigger(1); victoryTrigger.Position = new Vector2(0, 360); victoryTrigger.SetSize(200, 420); victoryTrigger.OnActivation += OnVictory; deathTrigger = new DeathTrigger(1); deathTrigger.Position = new Vector2(-500, sideScrollMap.Background.Height + 500); deathTrigger.SetSize(sideScrollMap.Background.Width + 1000, 512); deathTrigger.OnActivation += DeathTrigger_OnActivation; cake = new Cake(0, 360); GameManager.SetPreferredBackBufferSize(1920, 1080); }
public override void LoadContent() { SpriteSheet = GameManager.LoadTexture2D("SpriteSheetTD"); LoadSprites(GameManager.Content.RootDirectory + "/spritesheetTD.xml"); TopDownMap chamberOne = new TopDownMap("ChamberOne"); chamberOne.LoadMapFromImage(GameManager.LoadTexture2D("PortalChamberOneTiles")); chamberOne.LoadSpritesFromImage(GameManager.LoadTexture2D("PortalChamberOneSprites")); TopDownPlayer player = new TopDownPlayer(new Vector2(1, 3)); victoryTrigger = (VictoryTrigger)FindGameObject("VictoryTrigger"); victoryTrigger.OnActivation += OnVictory; AssignTriggers(); cubeTheOneAndOnly = ((TopDownWeightedCompanionCube)FindGameObject("Cube")); respawnButton.OnActivation += respawnButton_OnActivation; GameManager.SetPreferredBackBufferSize(chamberOne.Width * chamberOne.TileWidth, chamberOne.Height * chamberOne.TileHeight); }