ISpriteShapeに円を追加
@@ -77,11 +77,11 @@ | ||
77 | 77 | |
78 | 78 | this.Body = StageMap.World.CreateSpriteBody( this , position ); |
79 | 79 | 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() ); | |
81 | 81 | } |
82 | 82 | 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() ); | |
85 | 85 | } |
86 | 86 | this.Body.Load(); |
87 | 87 | } |
@@ -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 | +} |
@@ -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 | +} |
@@ -65,11 +65,16 @@ | ||
65 | 65 | |
66 | 66 | //} |
67 | 67 | |
68 | - public ISpriteShape CreateSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area) | |
68 | + public IPolygonSpriteShape CreatePolygonSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area) | |
69 | 69 | { |
70 | 70 | throw new NotImplementedException(); |
71 | 71 | } |
72 | 72 | |
73 | + public ICircleSpriteShape CreateCircleSpriteShape(SpriteShapeFilter filter, Circle area) | |
74 | + { | |
75 | + throw new NotImplementedException(); | |
76 | + } | |
77 | + | |
73 | 78 | public void Load() |
74 | 79 | { |
75 | 80 | throw new NotImplementedException(); |
@@ -18,20 +18,5 @@ | ||
18 | 18 | /// 衝突先のISpriteShape |
19 | 19 | /// </summary> |
20 | 20 | 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; } | |
36 | 21 | } |
37 | 22 | } |
@@ -11,14 +11,22 @@ | ||
11 | 11 | public interface ISpriteBody |
12 | 12 | { |
13 | 13 | /// <summary> |
14 | - /// 自身が保有するISpriteShapeを作成する | |
14 | + /// 自身が保有するIPolygonSpriteShapeを作成する | |
15 | 15 | /// </summary> |
16 | 16 | /// <param name="filter">衝突フィルター</param> |
17 | 17 | /// <param name="area">衝突範囲</param> |
18 | 18 | /// <returns>作成されたオブジェクト</returns> |
19 | - ISpriteShape CreateSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area); | |
19 | + IPolygonSpriteShape CreatePolygonSpriteShape(SpriteShapeFilter filter, IEnumerable<Vector> area); | |
20 | 20 | |
21 | 21 | /// <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> | |
22 | 30 | /// 自身が保有するISpriteShape群を元にIStageWorldへロードする |
23 | 31 | /// </summary> |
24 | 32 | void Load(); |
@@ -21,11 +21,6 @@ | ||
21 | 21 | SpriteShapeFilter Filter { get; } |
22 | 22 | |
23 | 23 | /// <summary> |
24 | - /// 衝突範囲 | |
25 | - /// </summary> | |
26 | - IEnumerable<Vector> Area { get; } | |
27 | - | |
28 | - /// <summary> | |
29 | 24 | /// 衝突結果 |
30 | 25 | /// </summary> |
31 | 26 | IEnumerable<ISpriteContact> Contacts { get; } |
@@ -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 | +} |
@@ -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 | +} |