Revision | 655 (tree) |
---|---|
Zeit | 2011-01-13 11:26:25 |
Autor | massa_senohito |
リストのアクセスレベルを下げ、Addtolistメソッドを追加
Boxクラスの整理
@@ -92,7 +92,7 @@ | ||
92 | 92 | Polygondef2 p2 = new Polygondef2(); |
93 | 93 | p2.Def(friction, restitution, density); |
94 | 94 | p2.SetAsBox(3, 3, new Vec2(20, 1), 0); |
95 | - d.plist.Add(p2); | |
95 | + d.Addtolist(p2); | |
96 | 96 | d.MakeBody(world); |
97 | 97 | |
98 | 98 | //自キャラとの距離を固定する |
@@ -36,12 +36,21 @@ | ||
36 | 36 | /// ボックスの再生成を許可するかのフラグ |
37 | 37 | /// </summary> |
38 | 38 | public bool alregene; |
39 | - | |
39 | + /// <summary> | |
40 | + /// | |
41 | + /// </summary> | |
42 | + List<PolygonDef> plist = new List<PolygonDef>(); | |
43 | + /// <summary> | |
44 | + /// ポリゴンのリストにpolygondefを加える | |
45 | + /// </summary> | |
46 | + /// <param name="p"></param> | |
47 | + public void Addtolist(PolygonDef p) | |
48 | + { | |
49 | + plist.Add(p); | |
50 | + } | |
51 | + #region 新コンストラクタ | |
52 | + //todo 新コンストラクタのクラス変数 | |
40 | 53 | //public Box(Vec2 pos, float angle, World world, float boxwidth, float boxheight, bool noRotateFlag, Dictionary<UserDataKind, string> userdata,Dictionary<ObjectDataKind,float> data) |
41 | - | |
42 | - //todo 新コンストラクタのクラス変数 | |
43 | - public List<PolygonDef> plist=new List<PolygonDef>(); | |
44 | - | |
45 | 54 | public Box(Vec2 pos, float angle) |
46 | 55 | { |
47 | 56 | Bodydef.Angle = angle; |
@@ -49,7 +58,6 @@ | ||
49 | 58 | } |
50 | 59 | public void SetAsBox(float boxwidth, float boxheight) |
51 | 60 | { |
52 | - | |
53 | 61 | plist.Add(makeshape(boxwidth, boxheight)); |
54 | 62 | } |
55 | 63 | public void SetAsBox(float boxwidth, float boxheight, Dictionary<ObjectDataKind, float> data,FilterData fil) |
@@ -58,6 +66,16 @@ | ||
58 | 66 | //todo data,filの値の指定を行うこと |
59 | 67 | plist.Add(p); |
60 | 68 | } |
69 | + static PolygonDef makeshape(float boxwidth, float boxheight) | |
70 | + { | |
71 | + PolygonDef p = new PolygonDef(); | |
72 | + p.SetAsBox(boxwidth, boxheight); | |
73 | + p.Friction = fric; | |
74 | + p.Restitution = rest; | |
75 | + p.Density = dens; | |
76 | + return p; | |
77 | + } | |
78 | + #endregion | |
61 | 79 | /* |
62 | 80 | public void ApplyUserData(Dictionary<ObjectDataKind, float> data, FilterData fil) |
63 | 81 | { |
@@ -67,15 +85,7 @@ | ||
67 | 85 | p.Filter = fil; |
68 | 86 | } |
69 | 87 | */ |
70 | - static PolygonDef makeshape(float boxwidth, float boxheight) | |
71 | - { | |
72 | - PolygonDef p = new PolygonDef(); | |
73 | - p.SetAsBox(boxwidth, boxheight); | |
74 | - p.Friction = fric; | |
75 | - p.Restitution = rest; | |
76 | - p.Density = dens; | |
77 | - return p; | |
78 | - } | |
88 | + | |
79 | 89 | /// <summary> |
80 | 90 | /// 最後にWorldを渡して指定されたポリゴンを作る |
81 | 91 | /// </summary> |