• R/O
  • SSH
  • HTTPS

nlgp1: Commit


Commit MetaInfo

Revision735 (tree)
Zeit2011-02-21 16:18:15
Autorbiikame

Log Message

Box2DX.Collision.AABBを参照するよう修正

Ändern Zusammenfassung

Diff

--- trunk/Nlgp1/Nlgp1/Characters/SpriteFactory.cs (revision 734)
+++ trunk/Nlgp1/Nlgp1/Characters/SpriteFactory.cs (revision 735)
@@ -13,10 +13,10 @@
1313 public static class SpriteFactory {
1414 private static Sprite create( int typeID , Vec2 location , Size characterSize ){
1515 var newSprite = new Character( typeID , SpriteType.Monster , characterSize , location );
16- newSprite.Bounds.BlankLeft = 2;
17- newSprite.Bounds.BlankRight = 2;
18- newSprite.Bounds.BlankTop = 0;
19- newSprite.Bounds.BlankBottom = 2;
16+ newSprite.Bound.BlankLeft = 2;
17+ newSprite.Bound.BlankRight = 2;
18+ newSprite.Bound.BlankTop = 0;
19+ newSprite.Bound.BlankBottom = 2;
2020 return newSprite;
2121 }
2222 /// <summary>
@@ -152,7 +152,7 @@
152152 case 14:
153153 #region 10秒アイテム
154154 newSprite.ActionEvent += new EventHandler<SpriteActionEventArgs>( ( sender , e ) => {
155- if( e.Target.Bounds.HitTest( PlayerStatus.Player.Bounds ) ) {
155+ if( e.Target.Bound.HitTest( PlayerStatus.Player.Bound ) ) {
156156 PlayerStatus.TimerInitialize();
157157 e.Target.Dispose();
158158 }
@@ -166,7 +166,7 @@
166166 if( SpriteAction.HitDirection( PlayerStatus.Player , e.Target ) == DirectionType.Top ) {
167167 SpriteAction.Physisorption( PlayerStatus.Player , e.Target , DirectionType.Top );
168168 if( e.Target.LogicParameter.Count >= 6 ) {
169- PlayerStatus.Player.TryMove( PlayerStatus.Player.Bounds.Width + PlayerStatus.Player.X + 2 , PlayerStatus.Player.Y );
169+ PlayerStatus.Player.TryMove( PlayerStatus.Player.Bound.Width + PlayerStatus.Player.X + 2 , PlayerStatus.Player.Y );
170170 e.Target.LogicParameter.Count = 0;
171171 }
172172 e.Target.LogicParameter.Count++;
@@ -181,7 +181,7 @@
181181 if( SpriteAction.HitDirection( PlayerStatus.Player , e.Target ) == DirectionType.Top ) {
182182 SpriteAction.Physisorption( PlayerStatus.Player , e.Target , DirectionType.Top );
183183 if( e.Target.LogicParameter.Count >= 6 ) {
184- PlayerStatus.Player.TryMove( PlayerStatus.Player.Bounds.Width + PlayerStatus.Player.X - 2 , PlayerStatus.Player.Y );
184+ PlayerStatus.Player.TryMove( PlayerStatus.Player.Bound.Width + PlayerStatus.Player.X - 2 , PlayerStatus.Player.Y );
185185 e.Target.LogicParameter.Count = 0;
186186 }
187187 e.Target.LogicParameter.Count++;
--- trunk/Nlgp1/Nlgp1/Stages/GameMap.cs (revision 734)
+++ trunk/Nlgp1/Nlgp1/Stages/GameMap.cs (revision 735)
@@ -122,7 +122,7 @@
122122 /// <returns>指定した座標に存在するスプライト</returns>
123123 public static IEnumerable< Sprite > GetSprites( Vec2 location ) {
124124 return Sprite.SpriteCollection().Cast< Sprite >().Where( ( sprite ) => {
125- return sprite.Bounds.HitTest( location );
125+ return sprite.Bound.HitTest( location );
126126 } );
127127 }
128128
--- trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 734)
+++ trunk/Nlgp1/Nlgp1/Sprites/Sprite.cs (revision 735)
@@ -65,7 +65,7 @@
6565 this.Motion = SpriteMotion.Get( layerType , imageTypeName , typeID , chipSize );
6666 this.Speed = new Speed();
6767 this.LogicParameter = new ActionParameter();
68- this.Bounds = new SpriteBound( this , MathEx.ToAABB( 0 , 0 , chipSize.Width , chipSize.Height ) );
68+ this.Bound = new SpriteBound( this , MathEx.ToAABB( 0 , 0 , chipSize.Width , chipSize.Height ) );
6969
7070 this.SpriteType = spriteType;
7171 this.TypeID = typeID;
@@ -142,7 +142,7 @@
142142 /// <summary>
143143 /// スプライトの位置、サイズを取得または、設定します。
144144 /// </summary>
145- public SpriteBound Bounds {
145+ public SpriteBound Bound {
146146 get;
147147 private set;
148148 }
@@ -362,16 +362,16 @@
362362 bool isTop = ( direction & DirectionFlags.Top ) != 0;
363363 bool isBottom = ( direction & DirectionFlags.Bottom ) != 0;
364364 if( isLeft && !isRight ) {
365- location.X = this.Bounds.Left;
365+ location.X = this.Bound.Left;
366366 }
367367 if( isRight && !isLeft ) {
368- location.X = this.Bounds.Right;
368+ location.X = this.Bound.Right;
369369 }
370370 if( isTop && !isBottom ) {
371- location.Y = this.Bounds.Top;
371+ location.Y = this.Bound.Top;
372372 }
373373 if( isBottom && !isTop ) {
374- location.Y = this.Bounds.Bottom;
374+ location.Y = this.Bound.Bottom;
375375 }
376376 return GameMap.GetSprites( location );
377377 }
@@ -391,16 +391,16 @@
391391 bool isTop = ( direction & DirectionFlags.Top ) != 0;
392392 bool isBottom = ( direction & DirectionFlags.Bottom ) != 0;
393393 if( isLeft && !isRight ) {
394- location.X = this.Bounds.Left;
394+ location.X = this.Bound.Left;
395395 }
396396 if( isRight && !isLeft ) {
397- location.X = this.Bounds.Right;
397+ location.X = this.Bound.Right;
398398 }
399399 if( isTop && !isBottom ) {
400- location.Y = this.Bounds.Top;
400+ location.Y = this.Bound.Top;
401401 }
402402 if( isBottom && !isTop ) {
403- location.Y = this.Bounds.Bottom;
403+ location.Y = this.Bound.Bottom;
404404 }
405405 return GameMap.IsStageArea( location );
406406 }
@@ -453,7 +453,7 @@
453453 public IEnumerable<Sprite> HitSpriteCollection() {
454454 foreach( Sprite obj in SpriteCollection() ) {
455455 if( obj != this && obj.IsBlock &&
456- obj.SpriteType != SpriteType.Hide && obj.SpriteType != this.SpriteType && Bounds.HitTest( obj.Bounds ) )
456+ obj.SpriteType != SpriteType.Hide && obj.SpriteType != this.SpriteType && Bound.HitTest( obj.Bound ) )
457457 yield return obj;
458458 }
459459 }
@@ -515,16 +515,16 @@
515515 switch( dir ) {
516516 case DirectionType.Top:
517517 #region 上方向
518- hitPos.Y = Bounds.Top;
518+ hitPos.Y = Bound.Top;
519519 if( isNotSprite == false )
520520 hitSprite = HitSprite( AspectType.Vertical );
521- for( int i = blank ; Bounds.Width - blank > i ; i++ ) {
522- hitPos.X = ( Bounds.Left + i );
521+ for( int i = blank ; Bound.Width - blank > i ; i++ ) {
522+ hitPos.X = ( Bound.Left + i );
523523 if( hitSprite != null || this.IsBlockSprite( hitPos ) ) {
524524 if( isRecovery ) {
525525 if( hitSprite != null ) {
526- float dirPos = RestDirection == ( RestDirection | DirectionFlags.Left ) ? hitSprite.Bounds.Right - Bounds.Width : hitSprite.Bounds.Left;
527- if( hitSprite.TryMove( dirPos , hitSprite.Bounds.Top - ( Bounds.Height - hitSprite.Bounds.Height ) ) == DirectionFlags.None )
526+ float dirPos = RestDirection == ( RestDirection | DirectionFlags.Left ) ? hitSprite.Bound.Right - Bound.Width : hitSprite.Bound.Left;
527+ if( hitSprite.TryMove( dirPos , hitSprite.Bound.Top - ( Bound.Height - hitSprite.Bound.Height ) ) == DirectionFlags.None )
528528 hitSprite.ResetPrev();
529529 } else {
530530 Y = ( hitPos.Y );
@@ -537,20 +537,20 @@
537537 #endregion
538538 case DirectionType.Bottom:
539539 #region 下方向
540- hitPos.Y = Bounds.Bottom;
540+ hitPos.Y = Bound.Bottom;
541541 if( isNotSprite == false )
542542 hitSprite = HitSprite( AspectType.Vertical );
543- for( int i = blank ; Bounds.Width - blank > i ; i++ ) {
544- hitPos.X = ( Bounds.Left + i );
543+ for( int i = blank ; Bound.Width - blank > i ; i++ ) {
544+ hitPos.X = ( Bound.Left + i );
545545 if( hitSprite != null || this.IsBlockSprite( hitPos ) ) {
546546 if( isRecovery ) {
547547 if( hitSprite != null && hitSprite.TryMove(
548548 hitSprite.X ,
549- hitSprite.Bounds.Top + ( Bounds.Height + hitSprite.Bounds.Height ) )
549+ hitSprite.Bound.Top + ( Bound.Height + hitSprite.Bound.Height ) )
550550 == DirectionFlags.None ) {
551551 hitSprite.ResetPrev();
552552 } else {
553- Y = ( hitPos.Y ) - Bounds.Height;
553+ Y = ( hitPos.Y ) - Bound.Height;
554554 }
555555 }
556556 return true;
@@ -560,15 +560,15 @@
560560 #endregion
561561 case DirectionType.Left:
562562 #region 左方向
563- hitPos.X = Bounds.Left;
563+ hitPos.X = Bound.Left;
564564 if( isNotSprite == false )
565565 hitSprite = HitSprite( AspectType.Horizontal );
566- for( int i = blank ; Bounds.Height - blank > i ; i++ ) {
567- hitPos.Y = ( Bounds.Bottom - i );
566+ for( int i = blank ; Bound.Height - blank > i ; i++ ) {
567+ hitPos.Y = ( Bound.Bottom - i );
568568 if( this.IsBlockSprite( hitPos ) || hitSprite != null ) {
569569 if( isRecovery ) {
570570 if( hitSprite != null ){
571- float toX = hitSprite.Bounds.Left - ( System.Math.Abs( X - PrevX ) );
571+ float toX = hitSprite.Bound.Left - ( System.Math.Abs( X - PrevX ) );
572572 float toY = Y;
573573 if( hitSprite.TryMove( toX , toY ) == DirectionFlags.None ){
574574 hitSprite.ResetPrev();
@@ -584,17 +584,17 @@
584584 #endregion
585585 case DirectionType.Right:
586586 #region 右方向
587- hitPos.X = Bounds.Right;
587+ hitPos.X = Bound.Right;
588588 if( isNotSprite == false )
589589 hitSprite = HitSprite( AspectType.Horizontal );
590- for( int i = blank ; Bounds.Height - blank > i ; i++ ) {
591- hitPos.Y = ( Bounds.Bottom - i );
590+ for( int i = blank ; Bound.Height - blank > i ; i++ ) {
591+ hitPos.Y = ( Bound.Bottom - i );
592592 if( this.IsBlockSprite( hitPos ) || hitSprite != null ) {
593593 if( isRecovery ) {
594- if( hitSprite != null && hitSprite.TryMove( hitSprite.Bounds.Left + ( System.Math.Abs( X - PrevX ) ) , hitSprite.Y ) == DirectionFlags.None ) {
594+ if( hitSprite != null && hitSprite.TryMove( hitSprite.Bound.Left + ( System.Math.Abs( X - PrevX ) ) , hitSprite.Y ) == DirectionFlags.None ) {
595595 hitSprite.ResetPrev();
596596 } else {
597- X = ( hitPos.X ) - Bounds.Width;
597+ X = ( hitPos.X ) - Bound.Width;
598598 }
599599 }
600600 return true;
@@ -619,7 +619,7 @@
619619 }
620620 private Sprite HitSprite( AspectType aspect ) {
621621 foreach( var s in HitSpriteCollection() ) {
622- if( s.IsBlock && Bounds.HitTest( s.Bounds , aspect ) && Bounds.HitTest( s.Bounds ) )
622+ if( s.IsBlock && Bound.HitTest( s.Bound , aspect ) && Bound.HitTest( s.Bound ) )
623623 return s;
624624 }
625625 return default( Sprite );
--- trunk/Nlgp1/Nlgp1/Program.cs (revision 734)
+++ trunk/Nlgp1/Nlgp1/Program.cs (revision 735)
@@ -97,10 +97,10 @@
9797 s.Y ,
9898 s.PrevX ,
9999 s.PrevY ,
100- s.Bounds.Top ,
101- s.Bounds.Bottom ,
102- s.Bounds.Left ,
103- s.Bounds.Right ,
100+ s.Bound.Top ,
101+ s.Bound.Bottom ,
102+ s.Bound.Left ,
103+ s.Bound.Right ,
104104 s.Speed.X ,
105105 s.Speed.Y ,
106106 s.RestDirection ,
Show on old repository browser