Box2DX.Collision.AABBを参照するよう修正
@@ -13,10 +13,10 @@ | ||
13 | 13 | public static class SpriteFactory { |
14 | 14 | private static Sprite create( int typeID , Vec2 location , Size characterSize ){ |
15 | 15 | 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; | |
20 | 20 | return newSprite; |
21 | 21 | } |
22 | 22 | /// <summary> |
@@ -152,7 +152,7 @@ | ||
152 | 152 | case 14: |
153 | 153 | #region 10秒アイテム |
154 | 154 | 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 ) ) { | |
156 | 156 | PlayerStatus.TimerInitialize(); |
157 | 157 | e.Target.Dispose(); |
158 | 158 | } |
@@ -166,7 +166,7 @@ | ||
166 | 166 | if( SpriteAction.HitDirection( PlayerStatus.Player , e.Target ) == DirectionType.Top ) { |
167 | 167 | SpriteAction.Physisorption( PlayerStatus.Player , e.Target , DirectionType.Top ); |
168 | 168 | 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 ); | |
170 | 170 | e.Target.LogicParameter.Count = 0; |
171 | 171 | } |
172 | 172 | e.Target.LogicParameter.Count++; |
@@ -181,7 +181,7 @@ | ||
181 | 181 | if( SpriteAction.HitDirection( PlayerStatus.Player , e.Target ) == DirectionType.Top ) { |
182 | 182 | SpriteAction.Physisorption( PlayerStatus.Player , e.Target , DirectionType.Top ); |
183 | 183 | 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 ); | |
185 | 185 | e.Target.LogicParameter.Count = 0; |
186 | 186 | } |
187 | 187 | e.Target.LogicParameter.Count++; |
@@ -122,7 +122,7 @@ | ||
122 | 122 | /// <returns>指定した座標に存在するスプライト</returns> |
123 | 123 | public static IEnumerable< Sprite > GetSprites( Vec2 location ) { |
124 | 124 | return Sprite.SpriteCollection().Cast< Sprite >().Where( ( sprite ) => { |
125 | - return sprite.Bounds.HitTest( location ); | |
125 | + return sprite.Bound.HitTest( location ); | |
126 | 126 | } ); |
127 | 127 | } |
128 | 128 |
@@ -65,7 +65,7 @@ | ||
65 | 65 | this.Motion = SpriteMotion.Get( layerType , imageTypeName , typeID , chipSize ); |
66 | 66 | this.Speed = new Speed(); |
67 | 67 | 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 ) ); | |
69 | 69 | |
70 | 70 | this.SpriteType = spriteType; |
71 | 71 | this.TypeID = typeID; |
@@ -142,7 +142,7 @@ | ||
142 | 142 | /// <summary> |
143 | 143 | /// スプライトの位置、サイズを取得または、設定します。 |
144 | 144 | /// </summary> |
145 | - public SpriteBound Bounds { | |
145 | + public SpriteBound Bound { | |
146 | 146 | get; |
147 | 147 | private set; |
148 | 148 | } |
@@ -362,16 +362,16 @@ | ||
362 | 362 | bool isTop = ( direction & DirectionFlags.Top ) != 0; |
363 | 363 | bool isBottom = ( direction & DirectionFlags.Bottom ) != 0; |
364 | 364 | if( isLeft && !isRight ) { |
365 | - location.X = this.Bounds.Left; | |
365 | + location.X = this.Bound.Left; | |
366 | 366 | } |
367 | 367 | if( isRight && !isLeft ) { |
368 | - location.X = this.Bounds.Right; | |
368 | + location.X = this.Bound.Right; | |
369 | 369 | } |
370 | 370 | if( isTop && !isBottom ) { |
371 | - location.Y = this.Bounds.Top; | |
371 | + location.Y = this.Bound.Top; | |
372 | 372 | } |
373 | 373 | if( isBottom && !isTop ) { |
374 | - location.Y = this.Bounds.Bottom; | |
374 | + location.Y = this.Bound.Bottom; | |
375 | 375 | } |
376 | 376 | return GameMap.GetSprites( location ); |
377 | 377 | } |
@@ -391,16 +391,16 @@ | ||
391 | 391 | bool isTop = ( direction & DirectionFlags.Top ) != 0; |
392 | 392 | bool isBottom = ( direction & DirectionFlags.Bottom ) != 0; |
393 | 393 | if( isLeft && !isRight ) { |
394 | - location.X = this.Bounds.Left; | |
394 | + location.X = this.Bound.Left; | |
395 | 395 | } |
396 | 396 | if( isRight && !isLeft ) { |
397 | - location.X = this.Bounds.Right; | |
397 | + location.X = this.Bound.Right; | |
398 | 398 | } |
399 | 399 | if( isTop && !isBottom ) { |
400 | - location.Y = this.Bounds.Top; | |
400 | + location.Y = this.Bound.Top; | |
401 | 401 | } |
402 | 402 | if( isBottom && !isTop ) { |
403 | - location.Y = this.Bounds.Bottom; | |
403 | + location.Y = this.Bound.Bottom; | |
404 | 404 | } |
405 | 405 | return GameMap.IsStageArea( location ); |
406 | 406 | } |
@@ -453,7 +453,7 @@ | ||
453 | 453 | public IEnumerable<Sprite> HitSpriteCollection() { |
454 | 454 | foreach( Sprite obj in SpriteCollection() ) { |
455 | 455 | 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 ) ) | |
457 | 457 | yield return obj; |
458 | 458 | } |
459 | 459 | } |
@@ -515,16 +515,16 @@ | ||
515 | 515 | switch( dir ) { |
516 | 516 | case DirectionType.Top: |
517 | 517 | #region 上方向 |
518 | - hitPos.Y = Bounds.Top; | |
518 | + hitPos.Y = Bound.Top; | |
519 | 519 | if( isNotSprite == false ) |
520 | 520 | 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 ); | |
523 | 523 | if( hitSprite != null || this.IsBlockSprite( hitPos ) ) { |
524 | 524 | if( isRecovery ) { |
525 | 525 | 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 ) | |
528 | 528 | hitSprite.ResetPrev(); |
529 | 529 | } else { |
530 | 530 | Y = ( hitPos.Y ); |
@@ -537,20 +537,20 @@ | ||
537 | 537 | #endregion |
538 | 538 | case DirectionType.Bottom: |
539 | 539 | #region 下方向 |
540 | - hitPos.Y = Bounds.Bottom; | |
540 | + hitPos.Y = Bound.Bottom; | |
541 | 541 | if( isNotSprite == false ) |
542 | 542 | 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 ); | |
545 | 545 | if( hitSprite != null || this.IsBlockSprite( hitPos ) ) { |
546 | 546 | if( isRecovery ) { |
547 | 547 | if( hitSprite != null && hitSprite.TryMove( |
548 | 548 | hitSprite.X , |
549 | - hitSprite.Bounds.Top + ( Bounds.Height + hitSprite.Bounds.Height ) ) | |
549 | + hitSprite.Bound.Top + ( Bound.Height + hitSprite.Bound.Height ) ) | |
550 | 550 | == DirectionFlags.None ) { |
551 | 551 | hitSprite.ResetPrev(); |
552 | 552 | } else { |
553 | - Y = ( hitPos.Y ) - Bounds.Height; | |
553 | + Y = ( hitPos.Y ) - Bound.Height; | |
554 | 554 | } |
555 | 555 | } |
556 | 556 | return true; |
@@ -560,15 +560,15 @@ | ||
560 | 560 | #endregion |
561 | 561 | case DirectionType.Left: |
562 | 562 | #region 左方向 |
563 | - hitPos.X = Bounds.Left; | |
563 | + hitPos.X = Bound.Left; | |
564 | 564 | if( isNotSprite == false ) |
565 | 565 | 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 ); | |
568 | 568 | if( this.IsBlockSprite( hitPos ) || hitSprite != null ) { |
569 | 569 | if( isRecovery ) { |
570 | 570 | 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 ) ); | |
572 | 572 | float toY = Y; |
573 | 573 | if( hitSprite.TryMove( toX , toY ) == DirectionFlags.None ){ |
574 | 574 | hitSprite.ResetPrev(); |
@@ -584,17 +584,17 @@ | ||
584 | 584 | #endregion |
585 | 585 | case DirectionType.Right: |
586 | 586 | #region 右方向 |
587 | - hitPos.X = Bounds.Right; | |
587 | + hitPos.X = Bound.Right; | |
588 | 588 | if( isNotSprite == false ) |
589 | 589 | 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 ); | |
592 | 592 | if( this.IsBlockSprite( hitPos ) || hitSprite != null ) { |
593 | 593 | 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 ) { | |
595 | 595 | hitSprite.ResetPrev(); |
596 | 596 | } else { |
597 | - X = ( hitPos.X ) - Bounds.Width; | |
597 | + X = ( hitPos.X ) - Bound.Width; | |
598 | 598 | } |
599 | 599 | } |
600 | 600 | return true; |
@@ -619,7 +619,7 @@ | ||
619 | 619 | } |
620 | 620 | private Sprite HitSprite( AspectType aspect ) { |
621 | 621 | 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 ) ) | |
623 | 623 | return s; |
624 | 624 | } |
625 | 625 | return default( Sprite ); |
@@ -97,10 +97,10 @@ | ||
97 | 97 | s.Y , |
98 | 98 | s.PrevX , |
99 | 99 | 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 , | |
104 | 104 | s.Speed.X , |
105 | 105 | s.Speed.Y , |
106 | 106 | s.RestDirection , |