• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision850 (tree)
Zeit2011-05-11 11:48:22
Autorbiikame

Log Message

Nlgp1.Parameters.CircleSpriteShape.PointRaiseの仮実装

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 849)
+++ trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 850)
@@ -86,7 +86,7 @@
8686 }
8787 else {
8888 this.Body = Stage.World.CreateSpriteBody( true , position );
89- this.Shape = this.Body.CreateCircleSpriteShape( new SpriteShapeFilter( 0xAAAA , 0x5555 ) , new Circle( Vector.Zero , Math.Min( chipSize.X , chipSize.Y ) ) );
89+ this.Shape = this.Body.CreateCircleSpriteShape( new SpriteShapeFilter( 0xAAAA , 0x5555 ) , new Circle( Vector.Zero , Math.Min( chipSize.X , chipSize.Y ) / 2.0f ) );
9090 }
9191 this.Body.Load();
9292 }
@@ -225,7 +225,9 @@
225225
226226 this.Body.Step();
227227
228- this.Owner.OnStepped( this , this.steppedEventArgs );
228+ if( this.Owner != null) {
229+ this.Owner.OnStepped( this , this.steppedEventArgs );
230+ }
229231 }
230232 #endregion
231233
--- trunk/Nlgp1/Nlgp1/Parameters/PolygonSpriteShape.cs (revision 849)
+++ trunk/Nlgp1/Nlgp1/Parameters/PolygonSpriteShape.cs (revision 850)
@@ -65,7 +65,8 @@
6565 //allContactPos.Add(contactpos);
6666 //seagmentIndexes.Add(i);
6767 spritecontact = new PolygonSpriteShapeContact(
68- this, ((SpriteUserData)shape.GetBody().GetUserData()).SpriteShape, contactpos,seagmentIndex, vertexIndex);
68+ this, ((SpriteUserData)shape.UserData).SpriteShape, contactpos,seagmentIndex, vertexIndex);
69+ this.contacts.Add(spritecontact);
6970 }
7071
7172
@@ -114,10 +115,13 @@
114115
115116 public event EventHandler<PolygonSpriteShapeSteppedEventArgs> Stepped;
116117 //
118+ private List<IPolygonSpriteShapeContact> contacts = new List<IPolygonSpriteShapeContact>();
117119 public IEnumerable<IPolygonSpriteShapeContact> Contacts
118120 {
119- get;
120- private set;
121+ get
122+ {
123+ return this.contacts;
124+ }
121125 }
122126
123127 public Polygon Area
--- trunk/Nlgp1/Nlgp1/Parameters/StageDebugDraw.cs (revision 849)
+++ trunk/Nlgp1/Nlgp1/Parameters/StageDebugDraw.cs (revision 850)
@@ -54,11 +54,12 @@
5454 private void DrawCircle( Vec2 center , float radius , Vec2 axis , Color color , bool isSolid ) {
5555 this.actions.Add( () => {
5656 Vec2 centerAsScreen = this.view.Transform( center );
57+ float radiusAsScreen = Vec2.Distance( centerAsScreen , this.view.Transform( new Vec2( center.X + radius , center.Y ) ) );
5758 if( isSolid ) {
58- this.debug.DrawSolidCircle( centerAsScreen , radius , axis , color );
59+ this.debug.DrawSolidCircle( centerAsScreen , radiusAsScreen , axis , color );
5960 }
6061 else {
61- this.debug.DrawCircle( centerAsScreen , radius , color );
62+ this.debug.DrawCircle( centerAsScreen , radiusAsScreen , color );
6263 }
6364 } );
6465 }
--- trunk/Nlgp1/Nlgp1/Parameters/CircleSpriteShape.cs (revision 849)
+++ trunk/Nlgp1/Nlgp1/Parameters/CircleSpriteShape.cs (revision 850)
@@ -2,6 +2,7 @@
22 using System.Collections.Generic;
33 using System.Linq;
44 using System.Text;
5+using Box2DX.Collision;
56
67 namespace Nlgp1.Parameters
78 {
@@ -14,9 +15,9 @@
1415 Type = SpriteShapeType.Circle;
1516 }
1617
17- public override void PointRaise(global::Box2DX.Collision.Shape shape, Vector contactpos)
18+ public override void PointRaise(Shape shape, Vector contactpos)
1819 {
19- throw new NotImplementedException();
20+ this.contacts.Add(new CircleSpriteShapeContact(this, ((SpriteUserData)(shape.UserData)).SpriteShape, contactpos, float.NaN));
2021 }
2122
2223 #region ICircleSpriteShape メンバ
@@ -29,10 +30,13 @@
2930
3031 public event EventHandler<CircleSpriteShapeSteppedEventArgs> Stepped;
3132
33+ private List<ICircleSpriteShapeContact> contacts = new List<ICircleSpriteShapeContact>();
3234 public IEnumerable<ICircleSpriteShapeContact> Contacts
3335 {
34- get;
35- set;
36+ get
37+ {
38+ return this.contacts;
39+ }
3640 }
3741
3842 #endregion
Show on old repository browser