Inheritance: Game.DrawObject
コード例 #1
0
ファイル: GhostBrick.cs プロジェクト: Chronophobe/STV_Stage1
 public override void OnHit(ref Ball b)
 {
     b.changed = true;
     b = new GhostBall(b);
     GameManager.AddScoreByFactor();
     StateSaver.SetBallState(StateSaver.BallStates.Transform);
 }
コード例 #2
0
 public override void OnHit(ref Ball b)
 {
     Debug.WriteLine("Hit!!!");
     b.changed = true;
     b = new ChargedBall(b);
     GameManager.AddScoreByFactor();
     StateSaver.SetBallState(StateSaver.BallStates.Transform);
 }
コード例 #3
0
 public override void OnHit(ref Ball b)
 {
     GameManager.AddScoreByFactor();
 }
コード例 #4
0
ファイル: BallTest.cs プロジェクト: Chronophobe/STV_Stage1
        private SizeF calculateSpeed(ref Ball b, RectangleF playerBox)
        {
            //Calculate the move vector when bouncing on the pad (player)
            float speed = b.moveVector.Size();
            float speedFactor = 1.05f;
            if (speed * speedFactor > playerBox.Height)
            {
                speed = playerBox.Height;
            }
            else
            {
                speed *= 1.05f;
            }

            float ballMiddle = b.boundingBox.Left + b.boundingBox.Width / 2;
            float ballOnPadPosition = (ballMiddle - (playerBox.Left - b.boundingBox.Width / 2)) / (playerBox.Width + b.boundingBox.Width);

            //convert between radians and degrees
            double angle = (Math.PI / 180) * (120 - 60 * ballOnPadPosition);
            float x = (float)Math.Cos(angle);
            float y = -(float)Math.Sin(angle);
            SizeF expected = new SizeF(x * speed, y * speed);

            return expected;
        }
コード例 #5
0
ファイル: ChargedBall.cs プロジェクト: Chronophobe/STV_Stage1
 public ChargedBall(Ball b)
     : base(b)
 {
 }
コード例 #6
0
ファイル: Brick.cs プロジェクト: Chronophobe/STV_Stage1
 /// <summary>
 /// What to do when the ball hits the brick
 /// </summary>
 /// <param name="b"></param>
 public abstract void OnHit(ref Ball b);
コード例 #7
0
ファイル: Player.cs プロジェクト: Chronophobe/STV_Stage1
 public Player(Point pos)
 {
     this.position = pos;
     this.size = new SizeF(GameSettings.PaddleWidth, GameSettings.PaddleHeight);
     this.ball = new RegularBall(pos + new Size(10, -10));
 }
コード例 #8
0
ファイル: GhostBall.cs プロジェクト: Chronophobe/STV_Stage1
 public GhostBall(Ball b)
     : base(b)
 {
 }
コード例 #9
0
ファイル: RegularBall.cs プロジェクト: Chronophobe/STV_Stage1
 public RegularBall(Ball b)
     : base(b)
 {
 }
コード例 #10
0
ファイル: Ball.cs プロジェクト: Chronophobe/STV_Stage1
 public Ball(Ball b)
 {
     this.position = b.position;
     this.moveVector = b.moveVector;
     this.size = new SizeF(10.0f, 10.0f);
 }