public virtual Vector2 checkCollisionWith(CollisionObjectInterface obj, CollisionDetectorInterface detector, HeightEnum height, float radDistance, Vector2 velocity)
 {
     if (detector.checkCollision(obj.getBounds(height), getBounds(height), radDistance, velocity) != Vector2.Zero)
     {
         handleCollision(obj);
     }
     return Vector2.Zero;
 }
 public virtual Vector2 checkCollisionWith(CollisionObjectInterface obj, CollisionDetectorInterface detector, HeightEnum height, float radDistance, Vector2 velocity)
 {
     if (!hasBeenPickedUp_ && detector.checkCollision(obj.getBounds(height), getBounds(height), radDistance, velocity) != Vector2.Zero
         && (obj is PlayableCharacterAbstract))
     {
         handleCollision(obj);
     }
     return Vector2.Zero;
 }
 public virtual Vector2 checkCollisionWith(CollisionObjectInterface obj, CollisionDetectorInterface detector, HeightEnum height, float radDistance, Vector2 velocity)
 {
     return detector.checkCollision(obj.getBounds(height), getBounds(height), radDistance, velocity);
 }
Beispiel #4
0
        public virtual Vector2 checkCollisionWith(CollisionObjectInterface obj, CollisionDetectorInterface detector, HeightEnum height, float radDistance, Vector2 velocity)
        {
            Vector2 translate = detector.checkCollision(obj.getBounds(height), getBounds(height), radDistance, velocity);
            if (translate != Vector2.Zero)
            {
                obj.collidedInto(this);
                collidedWith(obj);

                if (objectChangesHeight(obj))
                {
                    if (height == HeightEnum.HIGH)
                    {
                        height_.blocksHigh_ = false;
                    }
                    else
                    {
                        height_.blocksLow_ = false;
                    }
                }
                if (obj is CharacterAbstract)
                {
                    height_ = new Height(false, false);
                }
            }
            return Vector2.Zero;
        }
Beispiel #5
0
 public Vector2 checkCollisionWith(CollisionObjectInterface obj, CollisionDetectorInterface detector, HeightEnum height, float radDistance, Vector2 velocity)
 {
     if (detector.checkCollision(obj.getBounds(height), getBounds(height), radDistance, velocity) != Vector2.Zero)
     {
         collidedWith(obj);
         obj.collidedInto(this);
     }
     return Vector2.Zero;
 }
 public bool tryToPickUp(CharacterAbstract character, CollisionDetectorInterface detector)
 {
     float radDist = CommonFunctions.distance(character.getPosition(), position_);
     if (!hasBeenPickedUp_ && detector.checkCollision(character.getBounds(HeightEnum.LOW), bounds_, radDist, Vector2.Zero) != Vector2.Zero)
     {
         handleCollision(character);
         return true;
     }
     return true;
 }