Nlgp1.Charactersの修正を復元
@@ -1,5 +1,4 @@ | ||
1 | 1 | using System; |
2 | -using System.Collections.Generic; | |
3 | 2 | using Box2DX.Collision; |
4 | 3 | using Nlgp1.Attacks; |
5 | 4 | using Nlgp1.Attacks.Guns; |
@@ -15,53 +14,48 @@ | ||
15 | 14 | /// </summary> |
16 | 15 | public class Character : ISpriteOwner { |
17 | 16 | public Character( int typeID , SpriteType spriteType , VectorI characterSize , Vector position ) { |
18 | - UpGravity = 0.75f; | |
19 | - DownGravity = 2; | |
20 | - JumpPower = 5; | |
21 | - FlyGravity = 0.05f; | |
22 | - HitPoint = 1; | |
23 | - jumpBoost = 5; | |
24 | 17 | this.Sprite = new Sprite( LayerType.Character , typeID , spriteType , this , "CharacterImages" , characterSize , () => { |
18 | + Sprite sprite = this.Sprite; | |
25 | 19 | MotionType result = MotionType.RestRight; |
26 | - if( this.IsNowJumping == false && | |
27 | - ( this.MovingDirections == Directions.Left || this.MovingDirections == Directions.Right ) && this.Sprite.Body.Velocity != Vector.Zero ) { | |
20 | + if( sprite.IsNowJumping == false && | |
21 | + ( sprite.MovingDirections == Directions.Left || sprite.MovingDirections == Directions.Right ) && sprite.Body.Velocity != Vector.Zero ) { | |
28 | 22 | // 静止状態 |
29 | - if( this.Directions == ( this.Directions | Directions.Right ) ) | |
23 | + if( sprite.Directions == ( sprite.Directions | Directions.Right ) ) | |
30 | 24 | result = MotionType.RestRight; |
31 | 25 | else |
32 | 26 | result = MotionType.RestLeft; |
33 | - } else if( this.Directions == Directions.Right ) { | |
34 | - if( this.IsBoosting ) | |
27 | + } else if( sprite.Directions == Directions.Right ) { | |
28 | + if( sprite.IsBoosting ) | |
35 | 29 | result = MotionType.BoostRight; |
36 | 30 | else |
37 | 31 | result = MotionType.WalkRight; |
38 | - } else if( this.Directions == Directions.Left ) { | |
39 | - if( this.IsBoosting ) | |
32 | + } else if( sprite.Directions == Directions.Left ) { | |
33 | + if( sprite.IsBoosting ) | |
40 | 34 | result = MotionType.BoostLeft; |
41 | 35 | else |
42 | 36 | result = MotionType.WalkLeft; |
43 | - } else if( this.Directions == ( this.Directions | Directions.Right ) ) { | |
37 | + } else if( sprite.Directions == ( sprite.Directions | Directions.Right ) ) { | |
44 | 38 | // 右方向 |
45 | - if( this.Directions == ( this.Directions | Directions.Top ) ) { | |
46 | - if( this.IsBoosting ) | |
39 | + if( sprite.Directions == ( sprite.Directions | Directions.Top ) ) { | |
40 | + if( sprite.IsBoosting ) | |
47 | 41 | result = MotionType.BoostUpRight; |
48 | 42 | else |
49 | 43 | result = MotionType.UpRight; |
50 | 44 | } else { |
51 | - if( this.IsBoosting ) | |
45 | + if( sprite.IsBoosting ) | |
52 | 46 | result = MotionType.BoostDownRight; |
53 | 47 | else |
54 | 48 | result = MotionType.UpRight; |
55 | 49 | } |
56 | - } else if( this.Directions == ( this.Directions | Directions.Left ) ) { | |
50 | + } else if( sprite.Directions == ( sprite.Directions | Directions.Left ) ) { | |
57 | 51 | // 左方向 |
58 | - if( this.Directions == ( this.Directions | Directions.Top ) ) { | |
59 | - if( this.IsBoosting ) | |
52 | + if( sprite.Directions == ( sprite.Directions | Directions.Top ) ) { | |
53 | + if( sprite.IsBoosting ) | |
60 | 54 | result = MotionType.BoostUpLeft; |
61 | 55 | else |
62 | 56 | result = MotionType.UpLeft; |
63 | 57 | } else { |
64 | - if( this.IsBoosting ) | |
58 | + if( sprite.IsBoosting ) | |
65 | 59 | result = MotionType.BoostLeft; |
66 | 60 | else |
67 | 61 | result = MotionType.DownLeft; |
@@ -100,184 +94,5 @@ | ||
100 | 94 | } |
101 | 95 | } |
102 | 96 | #endregion |
103 | - | |
104 | - /// <summary> | |
105 | - /// 攻撃スロットに関連付けられているIAttackOwnerオブジェクトを取得します。 | |
106 | - /// </summary> | |
107 | - /// <param name="attackType">攻撃方法</param> | |
108 | - /// <returns>IAttackOwnerオブジェクト</returns> | |
109 | - public IAttackOwner GetAttackOwner( AttackType attackType ) { | |
110 | - return attackOwnerSlot[attackType]; | |
111 | - } | |
112 | - | |
113 | - /// <summary> | |
114 | - /// 攻撃のためのIAttackOwnerインスタンスを指定したスロットに登録する。 | |
115 | - /// </summary> | |
116 | - /// <param name="attackType">攻撃方法</param> | |
117 | - /// <param name="attackOwner">攻撃方法を実装したインスタンス</param> | |
118 | - public void SetAttackOwner( AttackType attackType , IAttackOwner attackOwner ) { | |
119 | - if( attackOwnerSlot.ContainsKey( attackType ) ) { | |
120 | - if( attackOwnerSlot[attackType] != null ) | |
121 | - attackOwnerSlot[attackType].Unload(); | |
122 | - attackOwnerSlot.Remove( attackType ); | |
123 | - } | |
124 | - attackOwnerSlot.Add( attackType , attackOwner ); | |
125 | - } | |
126 | - | |
127 | - private Dictionary<AttackType,IAttackOwner> attackOwnerSlot = new Dictionary<AttackType , IAttackOwner>(); | |
128 | - | |
129 | - #region 方向 | |
130 | - /// <summary> | |
131 | - /// スプライトの静止状態での向きを取得します。 | |
132 | - /// </summary> | |
133 | - public Directions Directions { | |
134 | - get; | |
135 | - private set; | |
136 | - } | |
137 | - /// <summary> | |
138 | - /// スプライトが移動している方向を取得します。 | |
139 | - /// </summary> | |
140 | - public Directions MovingDirections { | |
141 | - get; | |
142 | - private set; | |
143 | - } | |
144 | - /// <summary> | |
145 | - /// スプライトが衝突したBlock属性のセルの方向を取得します。 | |
146 | - /// </summary> | |
147 | - public Directions HitBlockDirections { | |
148 | - get; | |
149 | - private set; | |
150 | - } | |
151 | - /// <summary> | |
152 | - /// スプライトが上または、下方向に衝突したセル座標を取得します。 | |
153 | - /// </summary> | |
154 | - public Vector VerticalPos { | |
155 | - get; | |
156 | - private set; | |
157 | - } | |
158 | - /// <summary> | |
159 | - /// スプライトが左または、右方向に衝突したセル座標を取得します。 | |
160 | - /// </summary> | |
161 | - public Vector HorizontalPos { | |
162 | - get; | |
163 | - private set; | |
164 | - } | |
165 | - #endregion | |
166 | - | |
167 | - #region 動きを制御するパラメータ | |
168 | - /// <summary> | |
169 | - /// 上昇重力を設定または、取得します。 | |
170 | - /// </summary> | |
171 | - public float UpGravity { | |
172 | - get; | |
173 | - set; | |
174 | - } | |
175 | - /// <summary> | |
176 | - /// 降下重力を設定または、取得します。 | |
177 | - /// </summary> | |
178 | - public float DownGravity { | |
179 | - get; | |
180 | - set; | |
181 | - } | |
182 | - /// <summary> | |
183 | - /// 滞空時に掛かる重力を設定または、取得します。 | |
184 | - /// </summary> | |
185 | - public float FlyGravity { | |
186 | - get; | |
187 | - set; | |
188 | - } | |
189 | - /// <summary> | |
190 | - /// スプライトのジャンプ力を取得または、設定します。 | |
191 | - /// </summary> | |
192 | - public float JumpPower { | |
193 | - get; | |
194 | - set; | |
195 | - } | |
196 | - /// <summary> | |
197 | - /// 飛行中かどうか取得します。 | |
198 | - /// </summary> | |
199 | - public bool IsFlying { | |
200 | - get; | |
201 | - private set; | |
202 | - } | |
203 | - /// <summary> | |
204 | - /// スプライトを高速移動するかどうか設定または、取得します。 | |
205 | - /// </summary> | |
206 | - public bool IsBoosting { | |
207 | - get; | |
208 | - set; | |
209 | - } | |
210 | - #endregion | |
211 | - | |
212 | - #region 状態を管理するパラメータ | |
213 | - /// <summary> | |
214 | - /// スプライトが静止状態かどうか取得します。 | |
215 | - /// </summary> | |
216 | - public bool IsRest { | |
217 | - get { | |
218 | - return IsNowJumping == false && Sprite.Body.Velocity != Vector.Zero; | |
219 | - } | |
220 | - } | |
221 | - /// <summary> | |
222 | - /// スプライトが飛行中かどうか取得します。 | |
223 | - /// </summary> | |
224 | - public bool IsNowJumping { | |
225 | - get; | |
226 | - private set; | |
227 | - } | |
228 | - /// <summary> | |
229 | - /// スプライトがダメージを受けないようにするかどうか設定または、取得します。 | |
230 | - /// </summary> | |
231 | - public bool IsNotDamage { | |
232 | - get; | |
233 | - set; | |
234 | - } | |
235 | - /// <summary> | |
236 | - /// 残りヒットポイント | |
237 | - /// </summary> | |
238 | - public int HitPoint { | |
239 | - get; | |
240 | - set; | |
241 | - } | |
242 | - #endregion | |
243 | - | |
244 | - #region ロジック | |
245 | - /// <summary> | |
246 | - /// ジャンプを入力を開始します。 | |
247 | - /// </summary> | |
248 | - public void StartJump() { | |
249 | - if( IsNowJumping == false ) { | |
250 | - Sprite.Body.ApplyForce( new Vector( 0 , -JumpPower ) ); | |
251 | - jumpBoost = JumpPower; | |
252 | - } | |
253 | - } | |
254 | - /// <summary> | |
255 | - /// 強制的にジャンプする | |
256 | - /// </summary> | |
257 | - public void StartConstraintJump() { | |
258 | - Sprite.Body.ApplyForce( new Vector( 0 , -JumpPower ) ); | |
259 | - jumpBoost = JumpPower; | |
260 | - } | |
261 | - /// <summary> | |
262 | - /// ジャンプ入力を停止します。 | |
263 | - /// </summary> | |
264 | - public void StopJump() { | |
265 | - Sprite.Body.ApplyForce( new Vector( 0 , 0 ) ); | |
266 | - } | |
267 | - /// <summary> | |
268 | - /// 飛行を開始します。 | |
269 | - /// </summary> | |
270 | - public void StartFly() { | |
271 | - if( IsBoosting && IsNowJumping && MovingDirections == ( MovingDirections | Directions.Bottom ) ) | |
272 | - IsFlying = true; | |
273 | - } | |
274 | - /// <summary> | |
275 | - /// 飛行を停止します。 | |
276 | - /// </summary> | |
277 | - public void StopFly() { | |
278 | - IsFlying = false; | |
279 | - } | |
280 | - private float jumpBoost = 0; | |
281 | - #endregion | |
282 | 97 | } |
283 | 98 | } |
@@ -11,9 +11,9 @@ | ||
11 | 11 | |
12 | 12 | namespace Nlgp1.Characters { |
13 | 13 | public static class SpriteFactory { |
14 | - private static Character create( int typeID , Vector position , VectorI characterSize ){ | |
15 | - var character = new Character( typeID , SpriteType.Monster , characterSize , position ); | |
16 | - return character; | |
14 | + private static Sprite create( int typeID , Vector position , VectorI characterSize ){ | |
15 | + var sprite = new Character( typeID , SpriteType.Monster , characterSize , position ).Sprite; | |
16 | + return sprite; | |
17 | 17 | } |
18 | 18 | /// <summary> |
19 | 19 | /// キャラクタを生成してマップ上に配置します。 |
@@ -23,13 +23,13 @@ | ||
23 | 23 | /// <param name="characterSize">スプライトのサイズ</param> |
24 | 24 | /// <returns>生成されたキャラクタオブジェクト</returns> |
25 | 25 | public static Sprite CreateSprite( int typeID , Vector position , VectorI characterSize ) { |
26 | - var character = create( typeID , position , characterSize ); | |
26 | + var sprite = create( typeID , position , characterSize ); | |
27 | 27 | switch( typeID ) { |
28 | 28 | case 2: |
29 | 29 | break; |
30 | 30 | case 4: |
31 | 31 | #region ゆっくりと左に歩いてくる |
32 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
32 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
33 | 33 | e.SpriteOwner.Sprite.Body.ApplyForce( new Vector( -0.01f , 0 ) ); |
34 | 34 | } ); |
35 | 35 | #endregion |
@@ -36,7 +36,7 @@ | ||
36 | 36 | break; |
37 | 37 | case 5: |
38 | 38 | #region ゆっくりと右に歩いてくる |
39 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
39 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
40 | 40 | e.SpriteOwner.Sprite.Body.ApplyForce( new Vector( +0.01f , 0 ) ); |
41 | 41 | } ); |
42 | 42 | #endregion |
@@ -44,20 +44,20 @@ | ||
44 | 44 | case 6: |
45 | 45 | #region ジャンプしながら左に向かってくる |
46 | 46 | |
47 | - character.JumpPower = 4; | |
48 | - character.UpGravity = 0.05f; | |
49 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
47 | + sprite.JumpPower = 4; | |
48 | + sprite.UpGravity = 0.05f; | |
49 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
50 | 50 | e.SpriteOwner.Sprite.Body.ApplyForce( new Vector( -0.01f , 0 ) ); |
51 | - ( ( Character )( e.SpriteOwner ) ).StartJump(); | |
51 | + e.SpriteOwner.Sprite.StartJump(); | |
52 | 52 | } ); |
53 | 53 | #endregion |
54 | 54 | break; |
55 | 55 | case 7: |
56 | 56 | #region ジャンプしながら右に向かってくる |
57 | - character.JumpPower = 4; | |
58 | - character.UpGravity = 0.05f; | |
59 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
60 | - ( ( Character)( e.SpriteOwner ) ).StartJump(); | |
57 | + sprite.JumpPower = 4; | |
58 | + sprite.UpGravity = 0.05f; | |
59 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
60 | + e.SpriteOwner.Sprite.StartJump(); | |
61 | 61 | } ); |
62 | 62 | #endregion |
63 | 63 | break; |
@@ -69,14 +69,14 @@ | ||
69 | 69 | // newSprite.GetRectangle.PrevReset(); |
70 | 70 | // newSprite.LogicParameter.InitX = cellX * MapData.CellSize; |
71 | 71 | // newSprite.LogicParameter.InitY = cellY * MapData.CellSize; |
72 | - character.Sprite.Body.ApplyForce( new Vector( 1 , 0 ) ); | |
73 | - character.Sprite.Shape.Stepped += ( sender , e ) => { | |
72 | + sprite.Body.ApplyForce( new Vector( 1 , 0 ) ); | |
73 | + sprite.Shape.Stepped += ( sender , e ) => { | |
74 | 74 | }; |
75 | 75 | #endregion |
76 | 76 | break; |
77 | 77 | case 9: |
78 | 78 | #region 床から落下しないように左右に移動する。 |
79 | - character.Sprite.Shape.Stepped += ( sender , e ) => { | |
79 | + sprite.Shape.Stepped += ( sender , e ) => { | |
80 | 80 | }; |
81 | 81 | #endregion |
82 | 82 | break; |
@@ -83,29 +83,29 @@ | ||
83 | 83 | case 10: |
84 | 84 | #region 上下に浮遊する |
85 | 85 | // newSprite.CanDefaultAction = false; |
86 | - character.Sprite.LogicParameter.Radius = 50; // 半径 | |
87 | - character.Sprite.LogicParameter.Angle = 90; // 角度 | |
88 | - character.Sprite.LogicParameter.Speed = 1; // 速度 | |
89 | - character.Sprite.LogicParameter.LimitDistance = 100;// 移動距離 | |
90 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
86 | + sprite.LogicParameter.Radius = 50; // 半径 | |
87 | + sprite.LogicParameter.Angle = 90; // 角度 | |
88 | + sprite.LogicParameter.Speed = 1; // 速度 | |
89 | + sprite.LogicParameter.LimitDistance = 100;// 移動距離 | |
90 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
91 | 91 | } ); |
92 | 92 | #endregion |
93 | 93 | break; |
94 | 94 | case 11: |
95 | 95 | #region 時計回り |
96 | - character.Sprite.CanActDefault = false; // 既定の重力計算などを無効にする。 | |
97 | - character.Sprite.LogicParameter.Radius = 100; // 半径 | |
98 | - character.Sprite.LogicParameter.Speed = 8; // 回転速度 | |
99 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
96 | + sprite.CanActDefault = false; // 既定の重力計算などを無効にする。 | |
97 | + sprite.LogicParameter.Radius = 100; // 半径 | |
98 | + sprite.LogicParameter.Speed = 8; // 回転速度 | |
99 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
100 | 100 | } ); |
101 | 101 | #endregion |
102 | 102 | break; |
103 | 103 | case 12: |
104 | 104 | #region 反時計回り |
105 | - character.Sprite.IsBlock = false; | |
106 | - character.Sprite.LogicParameter.Speed = 2; | |
107 | - character.Sprite.LogicParameter.Radius = 100; | |
108 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
105 | + sprite.IsBlock = false; | |
106 | + sprite.LogicParameter.Speed = 2; | |
107 | + sprite.LogicParameter.Radius = 100; | |
108 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
109 | 109 | // Sprite.HitStop( PlayerStatus.Player , e.Target ); |
110 | 110 | } ); |
111 | 111 | #endregion |
@@ -112,18 +112,18 @@ | ||
112 | 112 | break; |
113 | 113 | case 13: |
114 | 114 | #region 空中を回転しながら浮遊する |
115 | - character.Sprite.LogicParameter.LimitDistance = 150; // 移動距離 | |
116 | - character.Sprite.LogicParameter.Speed = 2; // 上下に移動するときの速度 | |
117 | - character.Sprite.LogicParameter.Angle = 90; // 移動する方向。90度 = 上下方向。45度 = 斜めなど。 | |
118 | - character.Sprite.CanActDefault = false; | |
119 | - character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
120 | - character.Sprite.LogicParameter.Angle++; | |
115 | + sprite.LogicParameter.LimitDistance = 150; // 移動距離 | |
116 | + sprite.LogicParameter.Speed = 2; // 上下に移動するときの速度 | |
117 | + sprite.LogicParameter.Angle = 90; // 移動する方向。90度 = 上下方向。45度 = 斜めなど。 | |
118 | + sprite.CanActDefault = false; | |
119 | + sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
120 | + sprite.LogicParameter.Angle++; | |
121 | 121 | } ); |
122 | 122 | #endregion |
123 | 123 | break; |
124 | 124 | case 14: |
125 | 125 | #region 10秒アイテム |
126 | - character.Sprite.Shape.Stepped += ( sender ,e ) => { | |
126 | + sprite.Shape.Stepped += ( sender ,e ) => { | |
127 | 127 | foreach( ISpriteContact contact in e.Shape.Contacts ) { |
128 | 128 | if( contact.Target == PlayerStatus.Player.Sprite.Shape ) { |
129 | 129 | PlayerStatus.TimerInitialize(); |
@@ -145,7 +145,7 @@ | ||
145 | 145 | default: |
146 | 146 | break; |
147 | 147 | } |
148 | - return character.Sprite; | |
148 | + return sprite; | |
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
@@ -109,17 +109,17 @@ | ||
109 | 109 | |
110 | 110 | |
111 | 111 | if( PlayerController.Jump ) { |
112 | - PlayerStatus.Player.StartJump(); | |
112 | + PlayerStatus.Player.Sprite.StartJump(); | |
113 | 113 | } else if( PlayerController.Jumping == false ) { |
114 | - PlayerStatus.Player.StopJump(); | |
114 | + PlayerStatus.Player.Sprite.StopJump(); | |
115 | 115 | } |
116 | 116 | |
117 | - PlayerStatus.Player.IsBoosting = PlayerController.Boost; | |
117 | + PlayerStatus.Player.Sprite.IsBoosting = PlayerController.Boost; | |
118 | 118 | |
119 | 119 | if( PlayerController.Fly ) |
120 | - PlayerStatus.Player.StartFly(); | |
120 | + PlayerStatus.Player.Sprite.StartFly(); | |
121 | 121 | else |
122 | - PlayerStatus.Player.StopFly(); | |
122 | + PlayerStatus.Player.Sprite.StopFly(); | |
123 | 123 | |
124 | 124 | PlayerStatus.Player.AttackType = PlayerController.Attack ? AttackType.DivineBuster : AttackType.None; |
125 | 125 | #endregion |
@@ -21,7 +21,7 @@ | ||
21 | 21 | private static int playerTimer = 0; |
22 | 22 | |
23 | 23 | /// <summary> |
24 | - /// 残り時間の最大値をフレーム単位で取得します。 | |
24 | + /// 残り時間の最大値をミリ秒単位で取得します。 | |
25 | 25 | /// </summary> |
26 | 26 | public static int LimitMax { |
27 | 27 | get { |
@@ -29,11 +29,11 @@ | ||
29 | 29 | } |
30 | 30 | } |
31 | 31 | /// <summary> |
32 | - /// 残り時間(フレーム単位)で取得します。 | |
32 | + /// 残り時間(ミリ秒単位)で取得します。 | |
33 | 33 | /// </summary> |
34 | 34 | public static int TimeLimit { |
35 | 35 | get { |
36 | - return LimitMax - ( StageMap.TickCount - playerTimer ); | |
36 | + return LimitMax - ( Environment.TickCount - playerTimer ); | |
37 | 37 | } |
38 | 38 | } |
39 | 39 | /// <summary> |
@@ -40,7 +40,7 @@ | ||
40 | 40 | /// 残り時間を初期化します。 |
41 | 41 | /// </summary> |
42 | 42 | public static void TimerInitialize() { |
43 | - playerTimer = StageMap.TickCount; | |
43 | + playerTimer = Environment.TickCount; | |
44 | 44 | } |
45 | 45 | |
46 | 46 | /// <summary> |
@@ -63,7 +63,7 @@ | ||
63 | 63 | |
64 | 64 | // 自分自身のパラメータは、ここで設定する |
65 | 65 | Player = new Character( 1 , SpriteType.Player , MapData.DefaultChipSize , position ); |
66 | - Player.HitPoint = 100; | |
66 | + Player.Sprite.HitPoint = 100; | |
67 | 67 | // Player.GetRectangle.BlankLeft = -2; |
68 | 68 | // Player.GetRectangle.BlankRight = -2; |
69 | 69 | // Player.GetRectangle.BlankBottom = 32; |
@@ -112,9 +112,14 @@ | ||
112 | 112 | else { |
113 | 113 | this.sprite = SpriteFactory.CreateSprite( this.Cell.TypeID , this.Position , MapData.DefaultChipSize ); // キャラクタ |
114 | 114 | } |
115 | + this.sprite.Stepped += ( sender , e ) => { | |
116 | + this.sprite.Body.ApplyForce( new Vector( 0 , this.sprite.DownGravity ) ); | |
117 | + }; | |
115 | 118 | } |
116 | 119 | else { |
117 | 120 | this.sprite = new Sprite( this.LayerType , this.Cell.TypeID , SpriteType.Monster , null , Path.Combine( @"Stages\Defines\Maps\Normal" , this.LayerType.ToString() ) , MapData.DefaultChipSize , null , null , this.Position ); |
121 | + this.sprite.UpGravity = 0; | |
122 | + this.sprite.DownGravity = 0; | |
118 | 123 | } |
119 | 124 | this.sprite.IsBlock = ( this.Cell.Types & CellTypes.Wall ) != 0; |
120 | 125 | this.sprite.IsDestroyable = ( this.Cell.Types & CellTypes.Destroy ) != 0; |
@@ -1,49 +0,0 @@ | ||
1 | -using System; | |
2 | -using System.Collections.Generic; | |
3 | -using System.Linq; | |
4 | -using System.Text; | |
5 | -using Nlgp1.Parameters; | |
6 | -using Nlgp1.Stages; | |
7 | -using Nlgp1.Common; | |
8 | - | |
9 | -namespace Nlgp1.Sprites { | |
10 | - /// <summary> | |
11 | - /// スプライトの行動が発生したときのイベント引数 | |
12 | - /// </summary> | |
13 | - public class SpriteSteppingEventArgs : EventArgs { | |
14 | - /// <summary> | |
15 | - /// SpriteSteppingEventArgsクラスの新しいインスタンスを初期化します。 | |
16 | - /// </summary> | |
17 | - /// <param name="target">対象のスプライト</param> | |
18 | - public SpriteSteppingEventArgs( ISpriteOwner spriteOwner ) { | |
19 | - this.SpriteOwner = spriteOwner; | |
20 | - } | |
21 | - /// <summary> | |
22 | - /// 対象のスプライトを取得します。 | |
23 | - /// </summary> | |
24 | - public ISpriteOwner SpriteOwner { | |
25 | - get; | |
26 | - private set; | |
27 | - } | |
28 | - } | |
29 | - | |
30 | - /// <summary> | |
31 | - /// スプライトの行動が発生したときのイベント引数 | |
32 | - /// </summary> | |
33 | - public class SpriteSteppingEventArgs<T> : EventArgs where T : ISpriteOwner { | |
34 | - /// <summary> | |
35 | - /// SpriteSteppingEventArgsクラスの新しいインスタンスを初期化します。 | |
36 | - /// </summary> | |
37 | - /// <param name="target">対象のスプライト</param> | |
38 | - public SpriteSteppingEventArgs( T spriteOwner ) { | |
39 | - this.SpriteOwner = spriteOwner; | |
40 | - } | |
41 | - /// <summary> | |
42 | - /// 対象のスプライトを取得します。 | |
43 | - /// </summary> | |
44 | - public T SpriteOwner { | |
45 | - get; | |
46 | - private set; | |
47 | - } | |
48 | - } | |
49 | -} |
@@ -3,12 +3,14 @@ | ||
3 | 3 | using System.Linq; |
4 | 4 | using System.Text; |
5 | 5 | |
6 | -namespace Nlgp1.Sprites { | |
6 | +namespace Nlgp1.Sprites | |
7 | +{ | |
7 | 8 | /// <summary> |
8 | 9 | /// 上下左右での方向を表します。 |
9 | 10 | /// </summary> |
10 | 11 | [Flags] |
11 | - public enum Directions { | |
12 | + public enum Directions | |
13 | + { | |
12 | 14 | /// <summary> |
13 | 15 | /// 方向なし |
14 | 16 | /// </summary> |
@@ -24,7 +26,7 @@ | ||
24 | 26 | /// <summary> |
25 | 27 | /// 上 |
26 | 28 | /// </summary> |
27 | - Top = 4 , | |
29 | + Top = 3 , | |
28 | 30 | /// <summary> |
29 | 31 | /// 下 |
30 | 32 | /// </summary> |
@@ -33,7 +35,8 @@ | ||
33 | 35 | /// <summary> |
34 | 36 | /// 上・下・左・右の何れかを表す |
35 | 37 | /// </summary> |
36 | - public enum Direction { | |
38 | + public enum Direction | |
39 | + { | |
37 | 40 | /// <summary> |
38 | 41 | /// 左 |
39 | 42 | /// </summary> |
@@ -52,36 +55,10 @@ | ||
52 | 55 | Bottom = 3 , |
53 | 56 | } |
54 | 57 | /// <summary> |
55 | - /// 水平方向を表す。 | |
56 | - /// </summary> | |
57 | - public enum HorizontalDirection { | |
58 | - /// <summary> | |
59 | - /// 左 | |
60 | - /// </summary> | |
61 | - Left, | |
62 | - /// <summary> | |
63 | - /// 右 | |
64 | - /// </summary> | |
65 | - Right, | |
66 | - } | |
67 | - /// <summary> | |
68 | - /// 鉛直方向を表す。 | |
69 | - /// </summary> | |
70 | - public enum VerticalDirection { | |
71 | - /// <summary> | |
72 | - /// 上 | |
73 | - /// </summary> | |
74 | - Top, | |
75 | - /// <summary> | |
76 | - /// 下 | |
77 | - /// </summary> | |
78 | - Bottom, | |
79 | - } | |
80 | - | |
81 | - /// <summary> | |
82 | 58 | /// 縦・横方向を表す。 |
83 | 59 | /// </summary> |
84 | - public enum Aspect { | |
60 | + public enum Aspect | |
61 | + { | |
85 | 62 | /// <summary> |
86 | 63 | /// 横方向。水平 |
87 | 64 | /// </summary> |
@@ -19,6 +19,7 @@ | ||
19 | 19 | /// <summary> |
20 | 20 | /// 生存するスプライトをコレクションで取得します。 |
21 | 21 | /// </summary> |
22 | + /// <returns></returns> | |
22 | 23 | public static IEnumerable<Sprite> GetCollection() { |
23 | 24 | lock( objectList ) { |
24 | 25 | int count = objectList.Count; |
@@ -41,6 +42,10 @@ | ||
41 | 42 | } |
42 | 43 | |
43 | 44 | private int startTick = 0; |
45 | + private float jumpBoost = 0; | |
46 | + private Vector verticalPos = new Vector(); | |
47 | + private Vector horizontalPos = new Vector(); | |
48 | + private Dictionary<AttackType,IAttackOwner> attackOwnerSlot = new Dictionary<AttackType , IAttackOwner>(); | |
44 | 49 | |
45 | 50 | /// <summary> |
46 | 51 | /// Spriteのコンストラクタ |
@@ -69,11 +74,17 @@ | ||
69 | 74 | this.TypeID = typeID; |
70 | 75 | this.DebugID = debugID; |
71 | 76 | if( layerType != LayerType.Back ) { |
77 | + this.HitPoint = 1; | |
78 | + jumpBoost = 5; | |
79 | + UpGravity = 0.75f; | |
80 | + DownGravity = 2; | |
81 | + JumpPower = 5; | |
82 | + FlyGravity = 0.05f; | |
72 | 83 | IsBlock = true; |
73 | 84 | ActiveCellCount = 2; |
74 | 85 | CanActDefault = true; |
75 | 86 | startTick = StageMap.TickCount; |
76 | - steppedEventArgs = new SpriteSteppingEventArgs( this.Owner ); | |
87 | + steppedEventArgs = new SpriteSteppedEventArgs( this.Owner ); | |
77 | 88 | |
78 | 89 | this.Body = StageMap.World.CreateSpriteBody( this , position ); |
79 | 90 | if( layerType != LayerType.Character ) { |
@@ -104,6 +115,29 @@ | ||
104 | 115 | } |
105 | 116 | |
106 | 117 | /// <summary> |
118 | + /// 攻撃スロットに関連付けられているIAttackOwnerオブジェクトを取得します。 | |
119 | + /// </summary> | |
120 | + /// <param name="attackType">攻撃方法</param> | |
121 | + /// <returns>IAttackOwnerオブジェクト</returns> | |
122 | + public IAttackOwner GetAttackOwner( AttackType attackType ) { | |
123 | + return attackOwnerSlot[attackType]; | |
124 | + } | |
125 | + | |
126 | + /// <summary> | |
127 | + /// 攻撃のためのIAttackOwnerインスタンスを指定したスロットに登録する。 | |
128 | + /// </summary> | |
129 | + /// <param name="attackType">攻撃方法</param> | |
130 | + /// <param name="attackOwner">攻撃方法を実装したインスタンス</param> | |
131 | + public void SetAttackOwner( AttackType attackType , IAttackOwner attackOwner ) { | |
132 | + if( attackOwnerSlot.ContainsKey( attackType ) ) { | |
133 | + if( attackOwnerSlot[attackType] != null ) | |
134 | + attackOwnerSlot[attackType].Unload(); | |
135 | + attackOwnerSlot.Remove( attackType ); | |
136 | + } | |
137 | + attackOwnerSlot.Add( attackType , attackOwner ); | |
138 | + } | |
139 | + | |
140 | + /// <summary> | |
107 | 141 | /// レイヤーの種類を取得します。 |
108 | 142 | /// </summary> |
109 | 143 | public LayerType LayerType { |
@@ -143,8 +177,90 @@ | ||
143 | 177 | private set; |
144 | 178 | } |
145 | 179 | |
180 | + #region 方向 | |
181 | + /// <summary> | |
182 | + /// スプライトの静止状態での向きを取得します。 | |
183 | + /// </summary> | |
184 | + public Directions Directions { | |
185 | + get; | |
186 | + private set; | |
187 | + } | |
188 | + /// <summary> | |
189 | + /// スプライトが移動している方向を取得します。 | |
190 | + /// </summary> | |
191 | + public Directions MovingDirections { | |
192 | + get; | |
193 | + private set; | |
194 | + } | |
195 | + /// <summary> | |
196 | + /// スプライトが衝突したBlock属性のセルの方向を取得します。 | |
197 | + /// </summary> | |
198 | + public Directions HitBlockDirections { | |
199 | + get; | |
200 | + private set; | |
201 | + } | |
202 | + /// <summary> | |
203 | + /// スプライトが上または、下方向に衝突したセル座標を取得します。 | |
204 | + /// </summary> | |
205 | + public Vector VerticalPos { | |
206 | + get { | |
207 | + return verticalPos; | |
208 | + } | |
209 | + } | |
210 | + /// <summary> | |
211 | + /// スプライトが左または、右方向に衝突したセル座標を取得します。 | |
212 | + /// </summary> | |
213 | + public Vector HorizontalPos { | |
214 | + get { | |
215 | + return horizontalPos; | |
216 | + } | |
217 | + } | |
218 | + #endregion | |
219 | + | |
146 | 220 | #region 動きを制御するパラメータ |
147 | 221 | /// <summary> |
222 | + /// 上昇重力を設定または、取得します。 | |
223 | + /// </summary> | |
224 | + public float UpGravity { | |
225 | + get; | |
226 | + set; | |
227 | + } | |
228 | + /// <summary> | |
229 | + /// 降下重力を設定または、取得します。 | |
230 | + /// </summary> | |
231 | + public float DownGravity { | |
232 | + get; | |
233 | + set; | |
234 | + } | |
235 | + /// <summary> | |
236 | + /// 滞空時に掛かる重力を設定または、取得します。 | |
237 | + /// </summary> | |
238 | + public float FlyGravity { | |
239 | + get; | |
240 | + set; | |
241 | + } | |
242 | + /// <summary> | |
243 | + /// スプライトのジャンプ力を取得または、設定します。 | |
244 | + /// </summary> | |
245 | + public float JumpPower { | |
246 | + get; | |
247 | + set; | |
248 | + } | |
249 | + /// <summary> | |
250 | + /// 飛行中かどうか取得します。 | |
251 | + /// </summary> | |
252 | + public bool IsFlying { | |
253 | + get; | |
254 | + private set; | |
255 | + } | |
256 | + /// <summary> | |
257 | + /// スプライトを高速移動するかどうか設定または、取得します。 | |
258 | + /// </summary> | |
259 | + public bool IsBoosting { | |
260 | + get; | |
261 | + set; | |
262 | + } | |
263 | + /// <summary> | |
148 | 264 | /// スプライトの既定のアクションを実行してスプライトを適切に移動します。 |
149 | 265 | /// 規定値は、trueです。falseの場合も衝突判定を行いますがスプライトの移動は、行いません。 |
150 | 266 | /// </summary> |
@@ -179,6 +295,14 @@ | ||
179 | 295 | set; |
180 | 296 | } |
181 | 297 | /// <summary> |
298 | + /// スプライトが静止状態かどうか取得します。 | |
299 | + /// </summary> | |
300 | + public bool IsRest { | |
301 | + get { | |
302 | + return IsNowJumping == false && Body.Velocity != Vector.Zero; | |
303 | + } | |
304 | + } | |
305 | + /// <summary> | |
182 | 306 | /// スプライトを通過可能かどうか設定または、取得します。 |
183 | 307 | /// </summary> |
184 | 308 | public bool IsBlock { |
@@ -186,6 +310,27 @@ | ||
186 | 310 | set; |
187 | 311 | } |
188 | 312 | /// <summary> |
313 | + /// スプライトが飛行中かどうか取得します。 | |
314 | + /// </summary> | |
315 | + public bool IsNowJumping { | |
316 | + get; | |
317 | + private set; | |
318 | + } | |
319 | + /// <summary> | |
320 | + /// スプライトがダメージを受けないようにするかどうか設定または、取得します。 | |
321 | + /// </summary> | |
322 | + public bool IsNotDamage { | |
323 | + get; | |
324 | + set; | |
325 | + } | |
326 | + /// <summary> | |
327 | + /// 残りヒットポイント | |
328 | + /// </summary> | |
329 | + public int HitPoint { | |
330 | + get; | |
331 | + set; | |
332 | + } | |
333 | + /// <summary> | |
189 | 334 | /// 破壊可能か |
190 | 335 | /// </summary> |
191 | 336 | public bool IsDestroyable { |
@@ -203,7 +348,7 @@ | ||
203 | 348 | |
204 | 349 | #region ロジック |
205 | 350 | |
206 | - private SpriteSteppingEventArgs steppedEventArgs = null; | |
351 | + private SpriteSteppedEventArgs steppedEventArgs = null; | |
207 | 352 | |
208 | 353 | /// <summary> |
209 | 354 | /// キャラクタの既定の行動を行う |
@@ -218,14 +363,45 @@ | ||
218 | 363 | } |
219 | 364 | // 参考→http://d.hatena.ne.jp/Gemma/20080517/1211010942 |
220 | 365 | |
221 | - if( this.Stepping != null ) { | |
222 | - this.Stepping( this , this.steppedEventArgs ); | |
223 | - } | |
366 | + this.Body.Step(); | |
224 | 367 | |
225 | - if( this.Body != null ) { | |
226 | - this.Body.Step(); | |
368 | + this.OnStepped( this , this.steppedEventArgs ); | |
369 | + } | |
370 | + /// <summary> | |
371 | + /// ジャンプを入力を開始します。 | |
372 | + /// </summary> | |
373 | + public void StartJump() { | |
374 | + if( IsNowJumping == false ) { | |
375 | + Body.ApplyForce( new Vector( 0 , -JumpPower ) ); | |
376 | + jumpBoost = JumpPower; | |
227 | 377 | } |
228 | 378 | } |
379 | + /// <summary> | |
380 | + /// 強制的にジャンプする | |
381 | + /// </summary> | |
382 | + public void StartConstraintJump() { | |
383 | + Body.ApplyForce( new Vector( 0 , -JumpPower ) ); | |
384 | + jumpBoost = JumpPower; | |
385 | + } | |
386 | + /// <summary> | |
387 | + /// ジャンプ入力を停止します。 | |
388 | + /// </summary> | |
389 | + public void StopJump() { | |
390 | + Body.ApplyForce( new Vector( 0 , 0 ) ); | |
391 | + } | |
392 | + /// <summary> | |
393 | + /// 飛行を開始します。 | |
394 | + /// </summary> | |
395 | + public void StartFly() { | |
396 | + if( IsBoosting && IsNowJumping && MovingDirections == ( MovingDirections | Directions.Bottom ) ) | |
397 | + IsFlying = true; | |
398 | + } | |
399 | + /// <summary> | |
400 | + /// 飛行を停止します。 | |
401 | + /// </summary> | |
402 | + public void StopFly() { | |
403 | + IsFlying = false; | |
404 | + } | |
229 | 405 | #endregion |
230 | 406 | |
231 | 407 | #region ロジック拡張 |
@@ -239,7 +415,13 @@ | ||
239 | 415 | /// <summary> |
240 | 416 | /// 行動が発生して既定の行動が実行されたあとに発生します。 |
241 | 417 | /// </summary> |
242 | - public event EventHandler<SpriteSteppingEventArgs> Stepping; | |
418 | + public event EventHandler<SpriteSteppedEventArgs> Stepped; | |
419 | + | |
420 | + private void OnStepped( object sender , SpriteSteppedEventArgs e ) { | |
421 | + if( this.Stepped != null ) { | |
422 | + this.Stepped( sender , e ); | |
423 | + } | |
424 | + } | |
243 | 425 | #endregion |
244 | 426 | |
245 | 427 | #region IUnloadableComponent メンバー |
@@ -0,0 +1,49 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using Nlgp1.Parameters; | |
6 | +using Nlgp1.Stages; | |
7 | +using Nlgp1.Common; | |
8 | + | |
9 | +namespace Nlgp1.Sprites { | |
10 | + /// <summary> | |
11 | + /// スプライトの行動が発生したときのイベント引数 | |
12 | + /// </summary> | |
13 | + public class SpriteSteppedEventArgs : EventArgs { | |
14 | + /// <summary> | |
15 | + /// SpriteSteppedEventArgsクラスの新しいインスタンスを初期化します。 | |
16 | + /// </summary> | |
17 | + /// <param name="target">対象のスプライト</param> | |
18 | + public SpriteSteppedEventArgs( ISpriteOwner spriteOwner ) { | |
19 | + this.SpriteOwner = spriteOwner; | |
20 | + } | |
21 | + /// <summary> | |
22 | + /// 対象のスプライトを取得します。 | |
23 | + /// </summary> | |
24 | + public ISpriteOwner SpriteOwner { | |
25 | + get; | |
26 | + private set; | |
27 | + } | |
28 | + } | |
29 | + | |
30 | + /// <summary> | |
31 | + /// スプライトの行動が発生したときのイベント引数 | |
32 | + /// </summary> | |
33 | + public class SpriteSteppedEventArgs<T> : EventArgs where T : ISpriteOwner { | |
34 | + /// <summary> | |
35 | + /// SpriteSteppedEventArgsクラスの新しいインスタンスを初期化します。 | |
36 | + /// </summary> | |
37 | + /// <param name="target">対象のスプライト</param> | |
38 | + public SpriteSteppedEventArgs( T spriteOwner ) { | |
39 | + this.SpriteOwner = spriteOwner; | |
40 | + } | |
41 | + /// <summary> | |
42 | + /// 対象のスプライトを取得します。 | |
43 | + /// </summary> | |
44 | + public T SpriteOwner { | |
45 | + get; | |
46 | + private set; | |
47 | + } | |
48 | + } | |
49 | +} |
@@ -1,5 +1,4 @@ | ||
1 | 1 | using System; |
2 | -using Nlgp1.Characters; | |
3 | 2 | using Nlgp1.Sprites; |
4 | 3 | |
5 | 4 | namespace Nlgp1.Attacks { |
@@ -15,7 +14,7 @@ | ||
15 | 14 | /// <summary> |
16 | 15 | /// オブジェクトを所有するスプライトを取得します。 |
17 | 16 | /// </summary> |
18 | - Character Character { | |
17 | + ISpriteOwner SpriteOwner { | |
19 | 18 | get; |
20 | 19 | } |
21 | 20 |
@@ -1,7 +1,6 @@ | ||
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 | using Nlgp1.Attacks.Guns; |
4 | -using Nlgp1.Characters; | |
5 | 4 | using Nlgp1.Common; |
6 | 5 | using Nlgp1.Common.Parameters; |
7 | 6 | using Nlgp1.Sprites; |
@@ -14,7 +13,7 @@ | ||
14 | 13 | /// <typeparam name="T">弾丸クラスの型</typeparam> |
15 | 14 | public class Shot<T> : IAttackOwner where T : IGun , new() { |
16 | 15 | private List<T> gunList = new List<T>(); |
17 | - private Character character; | |
16 | + private ISpriteOwner ownerObject; | |
18 | 17 | |
19 | 18 | /// <summary> |
20 | 19 | /// Shotクラスのコンストラクタ |
@@ -22,9 +21,9 @@ | ||
22 | 21 | /// <param name="typeID">Shotクラスのオブジェクトに適応するイメージID</param> |
23 | 22 | /// <param name="gunTypeID">弾丸(IGun)に適応するイメージID</param> |
24 | 23 | /// <param name="gunSize">生成する弾のサイズ</param> |
25 | - public Shot( int typeID , int gunTypeID , Character character , VectorI gunSize ) { | |
26 | - this.Attack = new Attack( character , typeID , character.Sprite.SpriteType , gunSize ); | |
27 | - this.character = character; | |
24 | + public Shot( int typeID , int gunTypeID , ISpriteOwner spriteOwner , VectorI gunSize ) { | |
25 | + this.Attack = new Attack( spriteOwner , typeID , spriteOwner.Sprite.SpriteType , gunSize ); | |
26 | + this.ownerObject = spriteOwner; | |
28 | 27 | this.GunTypeID = gunTypeID; |
29 | 28 | this.GunSize = gunSize; |
30 | 29 | this.Attack.CanMovingAttack = false; |
@@ -34,7 +33,7 @@ | ||
34 | 33 | gun.Initialize( this.GunTypeID , this , gunSize ); |
35 | 34 | |
36 | 35 | if( Initialized != null ) |
37 | - Initialized( this , new SpriteSteppingEventArgs<T>( gun ) ); | |
36 | + Initialized( this , new SpriteSteppedEventArgs<T>( gun ) ); | |
38 | 37 | |
39 | 38 | lock( gunList ) |
40 | 39 | gunList.Add( gun ); |
@@ -82,9 +81,9 @@ | ||
82 | 81 | void IAttackOwner.Start() { |
83 | 82 | this.Attack.Start(); |
84 | 83 | } |
85 | - Character IAttackOwner.Character { | |
84 | + ISpriteOwner IAttackOwner.SpriteOwner { | |
86 | 85 | get { |
87 | - return character; | |
86 | + return ownerObject; | |
88 | 87 | } |
89 | 88 | } |
90 | 89 | #endregion |
@@ -94,6 +93,6 @@ | ||
94 | 93 | } |
95 | 94 | #endregion |
96 | 95 | |
97 | - public event EventHandler<SpriteSteppingEventArgs<T>> Initialized; | |
96 | + public event EventHandler<SpriteSteppedEventArgs<T>> Initialized; | |
98 | 97 | } |
99 | 98 | } |
@@ -1,5 +1,4 @@ | ||
1 | 1 | using System; |
2 | -using Nlgp1.Characters; | |
3 | 2 | using Nlgp1.Common; |
4 | 3 | using Nlgp1.Common.Parameters; |
5 | 4 | using Nlgp1.Parameters; |
@@ -18,14 +17,14 @@ | ||
18 | 17 | /// Attackクラスのインスタンスを作成します。 |
19 | 18 | /// </summary> |
20 | 19 | /// <param name="sprite">攻撃アクションを実行するスプライト(キャラクタなど)</param> |
21 | - public Attack( Character character , int typeID , SpriteType spriteType , VectorI attackSize ) { | |
20 | + public Attack( ISpriteOwner spriteOwner , int typeID , SpriteType spriteType , VectorI attackSize ) { | |
22 | 21 | CanMovingAttack = true; |
23 | - this.Character = character; | |
22 | + this.SpriteOwner = spriteOwner; | |
24 | 23 | // キャラクタスプライトが破棄されたとき、自分も破棄する。 |
25 | - this.Character.Sprite.Unloaded += new EventHandler( ( sender , e ) => Unload() ); | |
24 | + this.SpriteOwner.Sprite.Unloaded += new EventHandler( ( sender , e ) => Unload() ); | |
26 | 25 | |
27 | 26 | #region 攻撃状態の変化 |
28 | - this.Character.Sprite.Stepping += new EventHandler<SpriteSteppingEventArgs>( ( sender , e ) => { | |
27 | + this.SpriteOwner.Sprite.Stepped += new EventHandler<SpriteSteppedEventArgs>( ( sender , e ) => { | |
29 | 28 | if( ActionType == ActionType.None ) |
30 | 29 | return; |
31 | 30 | else if( ActionType == ActionType.Starting && StageMap.TickCount - attackTick >= StartingWait && canAttack ) { |
@@ -52,7 +51,7 @@ | ||
52 | 51 | /// <summary> |
53 | 52 | /// Attackオブジェクトを所有するスプライトを取得します。 |
54 | 53 | /// </summary> |
55 | - public Character Character { | |
54 | + public ISpriteOwner SpriteOwner { | |
56 | 55 | get; |
57 | 56 | private set; |
58 | 57 | } |
@@ -116,7 +115,7 @@ | ||
116 | 115 | |
117 | 116 | private bool canAttack { |
118 | 117 | get { |
119 | - return CanMovingAttack || Character.IsRest; | |
118 | + return CanMovingAttack || SpriteOwner.Sprite.IsRest; | |
120 | 119 | } |
121 | 120 | } |
122 | 121 |
@@ -22,7 +22,7 @@ | ||
22 | 22 | } |
23 | 23 | |
24 | 24 | /// <summary> |
25 | - /// 弾を生成したIAttackOwnerオブジェクトを取得します。 | |
25 | + /// 弾を生成したIShotオブジェクトを取得します。 | |
26 | 26 | /// </summary> |
27 | 27 | public IAttackOwner Owner { |
28 | 28 | get; |
@@ -32,7 +32,7 @@ | ||
32 | 32 | #region IGun メンバー |
33 | 33 | void IGun.Initialize( int typeID , IAttackOwner source , VectorI gunSize ) { |
34 | 34 | this.Owner = source; |
35 | - this.Sprite = new Sprite( LayerType.Character , typeID , source.Character.Sprite.SpriteType , this , "GunImages" , gunSize , null , null , new Vector() ); | |
35 | + this.Sprite = new Sprite( LayerType.Character , typeID , source.SpriteOwner.Sprite.SpriteType , this , "GunImages" , gunSize , null , null , new Vector() ); | |
36 | 36 | |
37 | 37 | |
38 | 38 | } |
@@ -62,7 +62,7 @@ | ||
62 | 62 | meiryoFont , new Common.Parameters.ColorI( 0x00 , 0xFF , 0xFF ) ); |
63 | 63 | |
64 | 64 | // if( message == null ) |
65 | - DebugCharacter( PlayerStatus.Player ); | |
65 | + DebugSprite( PlayerStatus.Player.Sprite ); | |
66 | 66 | |
67 | 67 | Form.DrawString( new VectorI( 5 , 32 ), message , meiryoFont , new Common.Parameters.ColorI( 0x00 , 0xFF , 0x00 ) ); |
68 | 68 |
@@ -83,7 +83,7 @@ | ||
83 | 83 | |
84 | 84 | private static string message = null; |
85 | 85 | |
86 | - public static void DebugCharacter( Character c ) { | |
86 | + public static void DebugSprite( Sprite s ) { | |
87 | 87 | message = string.Format( |
88 | 88 | @"Pos > X ={0} Y ={1} |
89 | 89 | Speed > X ={2} Y ={3} |
@@ -91,14 +91,14 @@ | ||
91 | 91 | MovingDir = {5} |
92 | 92 | Jump={6} Hit={7} FPS = {8} |
93 | 93 | " , |
94 | - c.Sprite.Body.Position.X , | |
95 | - c.Sprite.Body.Position.Y , | |
96 | - c.Sprite.Body.Velocity.X , | |
97 | - c.Sprite.Body.Velocity.Y , | |
98 | - c.Directions , | |
99 | - c.MovingDirections , | |
100 | - c.IsNowJumping , | |
101 | - c.HitPoint , | |
94 | + s.Body.Position.X , | |
95 | + s.Body.Position.Y , | |
96 | + s.Body.Velocity.X , | |
97 | + s.Body.Velocity.Y , | |
98 | + s.Directions , | |
99 | + s.MovingDirections , | |
100 | + s.IsNowJumping , | |
101 | + s.HitPoint , | |
102 | 102 | rate.FlameRate |
103 | 103 | ); |
104 | 104 | } |