• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision834 (tree)
Zeit2011-03-02 05:37:31
Autorbiikame

Log Message

ISpriteShapeに円を追加

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 833)
+++ trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 834)
@@ -77,11 +77,11 @@
7777
7878 this.Body = StageMap.World.CreateSpriteBody( this , position );
7979 if( layerType != LayerType.Character ) {
80- this.Body.CreateSpriteShape( new SpriteShapeFilter( 1 , 2 ), Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f , chipSize.Y / 2.0f ) ).ToVertices() );
80+ this.Body.CreatePolygonSpriteShape( new SpriteShapeFilter( 1 , 2 ), Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f , chipSize.Y / 2.0f ) ).ToVertices() );
8181 }
8282 else {
83- this.Body.CreateSpriteShape( new SpriteShapeFilter( 1 , 2 ), new Octagon( Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f - 2.0f , chipSize.Y / 2.0f - 2.0f ) ) , 0.5f ).ToVertices() );
84- this.Shape = this.Body.CreateSpriteShape( new SpriteShapeFilter( 2 , 1 ) , new Octagon( Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f - 2.0f , chipSize.Y / 2.0f - 2.0f ) ) , 0.5f ).ToVertices() );
83+ this.Body.CreatePolygonSpriteShape( new SpriteShapeFilter( 1 , 2 ), new Octagon( Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f - 2.0f , chipSize.Y / 2.0f - 2.0f ) ) , 0.5f ).ToVertices() );
84+ this.Shape = this.Body.CreatePolygonSpriteShape( new SpriteShapeFilter( 2 , 1 ) , new Octagon( Rectangle.FromCenterRadius( new Vector() , new Vector( chipSize.X / 2.0f - 2.0f , chipSize.Y / 2.0f - 2.0f ) ) , 0.5f ).ToVertices() );
8585 }
8686 this.Body.Load();
8787 }
--- trunk/Nlgp1/Nlgp1/Parameters/ICircleSpriteContact.cs (nonexistent)
+++ trunk/Nlgp1/Nlgp1/Parameters/ICircleSpriteContact.cs (revision 834)
@@ -0,0 +1,21 @@
1+using System;
2+using Box2DX.Common;
3+
4+namespace Nlgp1.Parameters
5+{
6+ /// <summary>
7+ /// ICircleSpriteShapeの衝突結果を表すISpriteContact
8+ /// </summary>
9+ public interface ICircleSpriteContact : ISpriteContact
10+ {
11+ /// <summary>
12+ /// 衝突位置
13+ /// </summary>
14+ Vec2 Position { get; }
15+
16+ /// <summary>
17+ /// 衝突角
18+ /// </summary>
19+ float Angle { get; }
20+ }
21+}
--- trunk/Nlgp1/Nlgp1/Parameters/ICircleSpriteShape.cs (nonexistent)
+++ trunk/Nlgp1/Nlgp1/Parameters/ICircleSpriteShape.cs (revision 834)
@@ -0,0 +1,16 @@
1+using System;
2+using Nlgp1.Utilities;
3+
4+namespace Nlgp1.Parameters
5+{
6+ /// <summary>
7+ /// 円形を表すISpriteShape
8+ /// </summary>
9+ public interface ICircleSpriteShape : ISpriteShape
10+ {
11+ /// <summary>
12+ /// 範囲
13+ /// </summary>
14+ Circle Area { get; }
15+ }
16+}
--- trunk/Nlgp1/Nlgp1/Parameters/SpriteBody.cs (revision 833)
+++ trunk/Nlgp1/Nlgp1/Parameters/SpriteBody.cs (revision 834)
@@ -65,11 +65,16 @@
6565
6666 //}
6767
68- public ISpriteShape CreateSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area)
68+ public IPolygonSpriteShape CreatePolygonSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area)
6969 {
7070 throw new NotImplementedException();
7171 }
7272
73+ public ICircleSpriteShape CreateCircleSpriteShape(SpriteShapeFilter filter, Circle area)
74+ {
75+ throw new NotImplementedException();
76+ }
77+
7378 public void Load()
7479 {
7580 throw new NotImplementedException();
--- trunk/Nlgp1/Nlgp1/Parameters/ISpriteContact.cs (revision 833)
+++ trunk/Nlgp1/Nlgp1/Parameters/ISpriteContact.cs (revision 834)
@@ -18,20 +18,5 @@
1818 /// 衝突先のISpriteShape
1919 /// </summary>
2020 ISpriteShape Target { get; }
21-
22- /// <summary>
23- /// Sourceからみた相対的な衝突位置
24- /// </summary>
25- Line Position { get; }
26-
27- /// <summary>
28- /// 衝突辺のインデックス群
29- /// </summary>
30- IEnumerable<int> EdgeIndices { get; }
31-
32- /// <summary>
33- /// 衝突頂点のインデックス群
34- /// </summary>
35- IEnumerable<int> VertexIndices { get; }
3621 }
3722 }
--- trunk/Nlgp1/Nlgp1/Parameters/ISpriteBody.cs (revision 833)
+++ trunk/Nlgp1/Nlgp1/Parameters/ISpriteBody.cs (revision 834)
@@ -11,14 +11,22 @@
1111 public interface ISpriteBody
1212 {
1313 /// <summary>
14- /// 自身が保有するISpriteShapeを作成する
14+ /// 自身が保有するIPolygonSpriteShapeを作成する
1515 /// </summary>
1616 /// <param name="filter">衝突フィルター</param>
1717 /// <param name="area">衝突範囲</param>
1818 /// <returns>作成されたオブジェクト</returns>
19- ISpriteShape CreateSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area);
19+ IPolygonSpriteShape CreatePolygonSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area);
2020
2121 /// <summary>
22+ /// 自身が保有するICircleSpriteShapeを作成する
23+ /// </summary>
24+ /// <param name="filter">衝突フィルター</param>
25+ /// <param name="area">衝突範囲</param>
26+ /// <returns>作成されたオブジェクト</returns>
27+ ICircleSpriteShape CreateCircleSpriteShape(SpriteShapeFilter filter, Circle area);
28+
29+ /// <summary>
2230 /// 自身が保有するISpriteShape群を元にIStageWorldへロードする
2331 /// </summary>
2432 void Load();
--- trunk/Nlgp1/Nlgp1/Parameters/ISpriteShape.cs (revision 833)
+++ trunk/Nlgp1/Nlgp1/Parameters/ISpriteShape.cs (revision 834)
@@ -21,11 +21,6 @@
2121 SpriteShapeFilter Filter { get; }
2222
2323 /// <summary>
24- /// 衝突範囲
25- /// </summary>
26- IEnumerable<Vector> Area { get; }
27-
28- /// <summary>
2924 /// 衝突結果
3025 /// </summary>
3126 IEnumerable<ISpriteContact> Contacts { get; }
--- trunk/Nlgp1/Nlgp1/Parameters/IPolygonSpriteContact.cs (nonexistent)
+++ trunk/Nlgp1/Nlgp1/Parameters/IPolygonSpriteContact.cs (revision 834)
@@ -0,0 +1,27 @@
1+using System;
2+using System.Collections.Generic;
3+using Nlgp1.Utilities;
4+
5+namespace Nlgp1.Parameters
6+{
7+ /// <summary>
8+ /// ISquareSpriteShapeの衝突結果を表す
9+ /// </summary>
10+ public interface IPolygonSpriteContact : ISpriteContact
11+ {
12+ /// <summary>
13+ /// Sourceからみた相対的な衝突位置
14+ /// </summary>
15+ Line Position { get; }
16+
17+ /// <summary>
18+ /// 衝突辺のインデックス群
19+ /// </summary>
20+ IEnumerable<int> EdgeIndices { get; }
21+
22+ /// <summary>
23+ /// 衝突頂点のインデックス群
24+ /// </summary>
25+ IEnumerable<int> VertexIndices { get; }
26+ }
27+}
--- trunk/Nlgp1/Nlgp1/Parameters/IPolygonSpriteShape.cs (nonexistent)
+++ trunk/Nlgp1/Nlgp1/Parameters/IPolygonSpriteShape.cs (revision 834)
@@ -0,0 +1,17 @@
1+using System;
2+using System.Collections.Generic;
3+using Nlgp1.Utilities;
4+
5+namespace Nlgp1.Parameters
6+{
7+ /// <summary>
8+ /// 四角形を表すISpriteShape
9+ /// </summary>
10+ public interface IPolygonSpriteShape : ISpriteShape
11+ {
12+ /// <summary>
13+ /// 衝突範囲
14+ /// </summary>
15+ IEnumerable<Vector> Area { get; }
16+ }
17+}
Show on old repository browser