public void register(CollisionObjectInterface obj) { if (!objects_.Contains(obj)) { objects_.Add(obj); } }
public virtual Vector2 checkCollisionInto(CollisionObjectInterface obj, CollisionDetectorInterface detector, Height height, float radDistance, Vector2 translate) { if (!hasBeenPickedUp_ && obj is PlayableCharacterAbstract) { handleCollision(obj); } return Vector2.Zero; }
public override void collidedInto(CollisionObjectInterface obj) { if (obj is Bullet || obj is ItemAbstract || obj is CoverObject) { return; } collidedInto_ = obj; }
public Vector2 checkCollisions(CollisionObjectInterface obj, Vector2 newPosition) { if(checkObjectCollisions(obj, newPosition)) { return obj.getPosition(); } return checkBoundsCollisions(obj, newPosition); }
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 override Vector2 checkCollisionInto(CollisionObjectInterface obj, CollisionDetectorInterface detector, Height height, float radDistance, Vector2 translate) { Vector2 normal = translate; //normal.Normalize(); //velocity_ = velocity_ - velocity_.Length() * (CommonFunctions.dotProduct(velocity_, normal)) * normal; velocity_ /= 2f; velocity_ = velocity_ - 2 * (CommonFunctions.dotProduct(velocity_, normal) / normal.LengthSquared()) * normal; return 2 * translate; }
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; }
protected Vector2 checkBoundsCollisions(CollisionObjectInterface obj, Vector2 newPosition) { //Point position = new Point((int)Math.Round(newPosition.X), (int)Math.Round(newPosition.Y)); float radius = obj.getRadius(); for (int i = 0; i < bounds_.Count; i++) { newPosition = bounds_[i].checkCollision(newPosition, radius); } return new Vector2(newPosition.X, newPosition.Y); }
public override void handleCollision(CollisionObjectInterface obj) { if (obj is CharacterAbstract) { //CharacterAmmo ammo = (obj as CharacterAbstract).getAmmo(); (obj as CharacterAbstract).Inventory_.Ammo_[Commando.objects.weapons.AmmoTypeEnum.BUCKSHOT] += Commando.objects.weapons.Shotgun.CLIP_SIZE; (obj as CharacterAbstract).Inventory_.Ammo_[Commando.objects.weapons.AmmoTypeEnum.BULLETS] += Commando.objects.weapons.Pistol.CLIP_SIZE; (obj as CharacterAbstract).Inventory_.Ammo_[Commando.objects.weapons.AmmoTypeEnum.ROUNDS] += Commando.objects.weapons.MachineGun.CLIP_SIZE; //int ammoCount = ammo.getValue(); //ammoCount += 5; //if (ammoCount > 20) //{ // ammoCount = 20; //} //ammo.update(ammoCount); toDie_ = true; hasBeenPickedUp_ = true; } }
public virtual Vector2 checkCollisionInto(CollisionObjectInterface obj, CollisionDetectorInterface detector, Height height, float radDistance, Vector2 translate) { if (objectChangesHeight(obj)) { if (height.blocksHigh_) { height_.blocksHigh_ = false; } if(height.blocksLow_) { height_.blocksLow_ = false; } } if (obj is CharacterAbstract) { height_ = new Height(false, false); } if (height_.blocksHigh_ || height_.blocksLow_) { return Vector2.Zero; } return translate; }
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; }
public abstract bool objectChangesHeight(CollisionObjectInterface obj);
public virtual void collidedWith(CollisionObjectInterface obj) { collidedInto_ = obj; }
public void collidedWith(CollisionObjectInterface obj) { handleCollision(obj); }
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 void addElement(int x, int y, CollisionObjectInterface obj) { }
public virtual void collidedInto(CollisionObjectInterface obj) { collidedInto_.Add(obj); }
public override bool objectChangesHeight(CollisionObjectInterface obj) { //return false; return !((obj is Bullet) || (obj is CharacterAbstract) || (obj is ItemAbstract) || (obj is LevelTransitionObject)); }
public abstract void damage(int amount, CollisionObjectInterface obj);
public void collidedWith(CollisionObjectInterface obj) { }
public void collidedInto(CollisionObjectInterface obj) { }
public override void damage(int amount, CollisionObjectInterface obj) { health_.update(health_.getValue() - amount); if (health_.getValue() <= 0) { die(); SoundEngine.getInstance().playCue("aahhzz"); currentDrawColor_ = Color.Brown; } else { currentDrawColor_ = Color.Salmon; drawColorCount_ = 2; } }
public virtual Vector2 checkCollisionInto(CollisionObjectInterface obj, CollisionDetectorInterface detector, Height height, float radDistance, Vector2 translate) { return translate; }
public virtual Vector2 checkCollisionInto(CollisionObjectInterface obj, CollisionDetectorInterface detector, Height height, float radDistance, Vector2 translate) { 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); }
public void collidedWith(CollisionObjectInterface obj) { if (obj is CharacterAbstract) { (obj as CharacterAbstract).setCoverObject(this); } }
public virtual void collidedWith(CollisionObjectInterface obj) { collidedWith_.Add(obj); }
public void handleCollision(CollisionObjectInterface obj) { if (obj is PlayableCharacterAbstract) { GlobalHelper.getInstance().getGameplayState().setTransition(this); } }
public override void damage(int amount, CollisionObjectInterface obj) { health_.update(health_.getValue() - amount); if (health_.getValue() <= 0) { this.die(); } }
public abstract void collidedWith(CollisionObjectInterface obj);