コード例 #1
0
ファイル: FallingPlatform.cs プロジェクト: bmh10/RedMan
 // Called when this platform has been hit by the player.
 public void OnContact(Player contactBy)
 {
     hit = true;
        Game.PlaySound(crackSound);
 }
コード例 #2
0
ファイル: Turret.cs プロジェクト: bmh10/RedMan
 public void OnContact(Player contactBy)
 {
     contactBy.OnKilled(null);
 }
コード例 #3
0
ファイル: Level.cs プロジェクト: bmh10/RedMan
        // Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected.
        private Tile LoadStartTile(int x, int y)
        {
            if (Player != null)
                throw new NotSupportedException("A level may only have one starting point.");

            start = RectangleExtensions.GetBottomCenter(GetBounds(x, y));
            // Loading main world after finishing or quiting a level
            if (Level.IsMainWorld && LoadMainWorldFromLevel)
                player = new Player(this, LastMainLevelCheckPoint);
            // Loading main world at beginning of game
            else if (Level.IsMainWorld)
            {
                LastMainLevelCheckPoint = start;
                player = new Player(this, LastMainLevelCheckPoint);
            }
            // Loading a normal level (from main world)
            else
            {
                lastCheckPoint = start;
                player = new Player(this, lastCheckPoint);
            }

            return new Tile(null, TileCollision.Passable);
        }
コード例 #4
0
ファイル: Level.cs プロジェクト: bmh10/RedMan
        // Called when a gem is collected.
        private void OnGemCollected(Gem gem, Player collectedBy)
        {
            score += Gem.PointValue;

            gem.OnCollected(collectedBy);
        }
コード例 #5
0
ファイル: Gem.cs プロジェクト: bmh10/RedMan
 // Called when this gem has been collected by a player and removed from the level.
 public void OnCollected(Player collectedBy)
 {
     Game.PlaySound(collectedSound);
 }