상속: RootObject
예제 #1
0
 public bool collidesWith(SpriteCollider other)
 {
     if (pixelCollision) {
         return Collision2D.collides(this,other);
     }
     return getBounds().overlaps(other.getBounds());
 }
        public void AddCollider(string name, Rectangle rectangle)
        {
            var collider = new SpriteCollider(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);

            collider.Type = SpriteCollider.ColliderType.Block;
            _framesList[name].Collider = collider;
        }
예제 #3
0
 private Collision2D(SpriteCollider a, SpriteCollider b)
 {
     this.a = a;
     this.b = b;
     boundsA = a.getBounds();
     boundsB = b.getBounds();
     checkCollsion();
 }
예제 #4
0
 private Collision2D(SpriteCollider a, SpriteCollider b)
 {
     this.a  = a;
     this.b  = b;
     boundsA = a.getBounds();
     boundsB = b.getBounds();
     checkCollsion();
 }
예제 #5
0
 public bool collidesWith(SpriteCollider other)
 {
     if (pixelCollision)
     {
         return(Collision2DSprite.collides(this, other));
     }
     return(getBounds().overlaps(other.getBounds()));
 }
 public void AddAttackCollider(string name, List <List <Rectangle> > rectangleFrames, int attackWidth)
 {
     for (var i = 0; i < rectangleFrames.Count; i++)
     {
         for (var j = 0; j < rectangleFrames[i].Count; j++)
         {
             var collider = new SpriteCollider(rectangleFrames[i][j].X, rectangleFrames[i][j].Y, rectangleFrames[i][j].Width, rectangleFrames[i][j].Height);
             collider.Type        = SpriteCollider.ColliderType.Attack;
             collider.AttackWidth = attackWidth;
             _framesList[name].Frames[i].AttackColliders.Add(collider);
         }
     }
 }
 private Texture2D GetColliderTexture(SpriteCollider collider)
 {
     return(collider.Type == SpriteCollider.ColliderType.Block ? _colliderRedTexture : _colliderYellowTexture);
 }
예제 #8
0
 public virtual void ReceiveAttackWithCollider(int damage, Rectangle subjectRect, SpriteCollider colider)
 {
     ReceiveAttackWithPoint(damage, subjectRect);
 }
예제 #9
0
 public static bool collides(SpriteCollider a, SpriteCollider b)
 {
     return new Collision2D(a,b).collision;
 }
예제 #10
0
 public static bool collides(SpriteCollider a, SpriteCollider b)
 {
     return(new Collision2D(a, b).collision);
 }
 public override void ReceiveAttackWithCollider(int damage, Rectangle subjectRect, SpriteCollider colider)
 {
     if (_wheelMode)
     {
         var x = Math.Sign(subjectRect.Center.X - BoundingRectangle.Center.X) < 0 ? BoundingRectangle.Left : BoundingRectangle.Right;
         var y = colider.BoundingBox.Center.Y;
         ((SceneMap)SceneManager.Instance.GetCurrentScene()).CreateSparkParticle(new Vector2(x, y));
     }
     base.ReceiveAttackWithCollider(damage, subjectRect, colider);
 }