Changeset 5354
- Timestamp:
- 2014-07-03 13:40:12 (9 years ago)
- Location:
- 2014/27/AleksanteriV/Protokolla236
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/27/AleksanteriV/Protokolla236/Protokolla236/Protokolla236/MikonPhysicsObject.cs
r5337 r5354 12 12 private Vector velocity; 13 13 public Vector Velocity { get { return velocity; } set { velocity = value; } } 14 private Angle angularVelocity; 15 public Angle AngularVelocity { get { return angularVelocity; } set { angularVelocity = value; } } 14 16 private double mass; 15 17 public double Mass { get { return mass; } set { mass = value; } } 18 private bool ignoresGravity; 19 public bool IgnoresGravity { get { return ignoresGravity; } set { ignoresGravity = value; } } 16 20 public override void Update(Time time) 17 21 { 18 this.Position += this.velocity / this.mass / 40; 19 if (this.parent.Level.Left > this.Position.X || this.parent.Level.Right < this.Position.X) { 22 this.Position += this.velocity / this.mass / 20; 23 if (!this.ignoresGravity) 24 { 25 this.Velocity += this.parent.Gravity / 120; 26 } 27 this.Angle += this.angularVelocity; 28 if (this.parent.Level.Left > this.Position.X || this.parent.Level.Right < this.Position.X) 29 { 20 30 this.Destroy(); 21 31 } 22 if (this.parent.Level.Bottom > this.Position.Y || this.parent.Level.Top < this.Position.Y) { 32 if (this.parent.Level.Bottom > this.Position.Y || this.parent.Level.Top < this.Position.Y) 33 { 23 34 this.Destroy(); 24 35 } 25 36 base.Update(time); 26 37 } 27 public MikonParticle(Protokolla236 parent, double w, double h)38 public MikonParticle(Protokolla236 parent, double w, double h) 28 39 : base(w, h) 29 40 { … … 91 102 else 92 103 { 93 MikonParticle childBox = new MikonParticle(this.game, pieceWidth, pieceHeight);104 MikonParticle childBox = new MikonParticle(this.game, pieceWidth, pieceHeight); 94 105 childBox.Tag = this.Tag; 95 //childBox.IgnoresGravity = this.IgnoresGravity;106 childBox.IgnoresGravity = this.IgnoresGravity; 96 107 childBox.Image = imageArea; 97 108 childBox.Mass = this.Mass; 98 109 99 110 childBox.AbsoluteAngle = this.AbsoluteAngle; 100 //childBox.AngularVelocity = this.AngularVelocity;111 childBox.AngularVelocity = Angle.FromDegrees(this.AngularVelocity * 7); 101 112 102 113 childBox.Position = this.Position + startCorner … … 104 115 + Vector.FromLengthAndAngle(y * pieceHeight, this.AbsoluteAngle + Angle.RightAngle); //plus y 105 116 106 childBox.Velocity = this.Velocity ;117 childBox.Velocity = this.Velocity + RandomGen.NextVector(10, 30); 107 118 108 119 //if (RandomGen.NextDouble(0, 1) < 0.2)
Note: See TracChangeset
for help on using the changeset viewer.