• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision727 (tree)
Zeit2011-02-21 10:11:11
Autorbiikame

Log Message

Nlgp1.Attacks.Guns.IGun.Initializeを追加

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Attacks/Shot.cs (revision 726)
+++ trunk/Nlgp1/Nlgp1/Attacks/Shot.cs (revision 727)
@@ -10,7 +10,7 @@
1010 /// 弾丸を生成する。
1111 /// </summary>
1212 /// <typeparam name="T">弾丸クラスの型</typeparam>
13- public class Shot<T> : Attack , IAttack where T : IGun {
13+ public class Shot<T> : Attack , IAttack where T : IGun , new() {
1414 private List<T> gunList = new List<T>();
1515 private Sprite ownerObject;
1616
@@ -29,7 +29,8 @@
2929 this.CanMoveingAttack = false;
3030
3131 this.Attacking += new EventHandler( ( sender , e ) => {
32- T gun = Utility.Construct< T >( this.GunTypeID , this , gunSize , new LocationF() );
32+ T gun = new T();
33+ gun.Initialize( this.GunTypeID , this , gunSize , null , new LocationF() );
3334
3435 if( InitializeEvent != null )
3536 InitializeEvent( this , new SpriteActionEventArgs<T>( gun ) );
--- trunk/Nlgp1/Nlgp1/Attacks/Guns/IGun.cs (revision 726)
+++ trunk/Nlgp1/Nlgp1/Attacks/Guns/IGun.cs (revision 727)
@@ -6,5 +6,14 @@
66 /// 弾丸を表す
77 /// </summary>
88 public interface IGun : ISprite {
9+ /// <summary>
10+ /// 弾丸を初期化します。
11+ /// </summary>
12+ /// <param name="typeID">弾の種類を表すID</param>
13+ /// <param name="source">弾の作成元のIShotオブジェクト</param>
14+ /// <param name="gunSize">弾のサイズ</param>
15+ /// <param name="debugID">デバッグ用 識別子 (通常使わない)</param>
16+ /// <param name="location">初期位置</param>
17+ void Initialize( int typeID , IAttack source , Size gunSize , string debugID , LocationF location );
918 }
1019 }
--- trunk/Nlgp1/Nlgp1/Attacks/Guns/Gun.cs (revision 726)
+++ trunk/Nlgp1/Nlgp1/Attacks/Guns/Gun.cs (revision 727)
@@ -27,11 +27,14 @@
2727 private set;
2828 }
2929
30- public Gun( int typeID , IAttack source , Size gunSize , LocationF location )
31- {
30+ #region IGun メンバー
31+ void IGun.Initialize( int typeID , IAttack source , Size gunSize , string debugID , LocationF location ) {
3232 this.Owner = source;
33- this.Sprite = new Sprite( LayerType.Character , typeID , source.Owner.SpriteType , this , "GunImages" , gunSize , null , location );
33+ this.Sprite = new Sprite( LayerType.Character , typeID , source.Owner.SpriteType , this , "GunImages" , gunSize , debugID , location );
34+
35+
3436 }
37+ #endregion
3538
3639 #region IDisposable メンバー
3740 public void Dispose() {
Show on old repository browser