• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision655 (tree)
Zeit2011-01-13 11:26:25
Autormassa_senohito

Log Message

リストのアクセスレベルを下げ、Addtolistメソッドを追加
Boxクラスの整理

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1.B2DX/Gamemain.cs (revision 654)
+++ trunk/Nlgp1/Nlgp1.B2DX/Gamemain.cs (revision 655)
@@ -92,7 +92,7 @@
9292 Polygondef2 p2 = new Polygondef2();
9393 p2.Def(friction, restitution, density);
9494 p2.SetAsBox(3, 3, new Vec2(20, 1), 0);
95- d.plist.Add(p2);
95+ d.Addtolist(p2);
9696 d.MakeBody(world);
9797
9898 //自キャラとの距離を固定する
--- trunk/Nlgp1/Nlgp1.B2DX/Box.cs (revision 654)
+++ trunk/Nlgp1/Nlgp1.B2DX/Box.cs (revision 655)
@@ -36,12 +36,21 @@
3636 /// ボックスの再生成を許可するかのフラグ
3737 /// </summary>
3838 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 新コンストラクタのクラス変数
4053 //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-
4554 public Box(Vec2 pos, float angle)
4655 {
4756 Bodydef.Angle = angle;
@@ -49,7 +58,6 @@
4958 }
5059 public void SetAsBox(float boxwidth, float boxheight)
5160 {
52-
5361 plist.Add(makeshape(boxwidth, boxheight));
5462 }
5563 public void SetAsBox(float boxwidth, float boxheight, Dictionary<ObjectDataKind, float> data,FilterData fil)
@@ -58,6 +66,16 @@
5866 //todo data,filの値の指定を行うこと
5967 plist.Add(p);
6068 }
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
6179 /*
6280 public void ApplyUserData(Dictionary<ObjectDataKind, float> data, FilterData fil)
6381 {
@@ -67,15 +85,7 @@
6785 p.Filter = fil;
6886 }
6987 */
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+
7989 /// <summary>
8090 /// 最後にWorldを渡して指定されたポリゴンを作る
8191 /// </summary>
Show on old repository browser