コード例 #1
0
        /// <summary>
        /// Determines if a cube can respawn after its destruction.
        /// </summary>
        private void SetCubeRespawnability()
        {
            List <TopDownWeightedCompanionCube> cubes = new List <TopDownWeightedCompanionCube>();

            foreach (var item in addedGameObjects)
            {
                if (item is TopDownWeightedCompanionCube)
                {
                    cubes.Add((TopDownWeightedCompanionCube)item);
                }
            }

            cubes.Find(c => c.ID == 3).IsRespawnable = false;
            cubes.Find(c => c.ID == 4).IsRespawnable = false;
            cubeID1 = cubes.Find(c => c.ID == 1);
            cubeID2 = cubes.Find(c => c.ID == 2);
        }
コード例 #2
0
        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);
        }