public override void OnCollision(CollidableEntity other) { base.OnCollision(other); if (other is Projectile p && p.MovingUp) { this.Collection.Get <GroundCannon>().Get <ScoreComponent>().Score += size == Size.Small ? 30 : size == Size.Medium ? 20 : 10; this.Destroy(); } }
public override void OnCollision(CollidableEntity other) { base.OnCollision(other); if (other is Projectile p && p.MovingUp) { this.Collection.Get <GroundCannon>().Get <ScoreComponent>().Score += 100; MotionComponent motion = this.Get <MotionComponent>(); motion.Velocity *= -1.1f; //reverse and speed up this.Position = new Vector2(-this.MaxPos * System.Math.Sign(motion.Velocity.X), this.Position.Y); } }
public override void OnCollision(CollidableEntity other) { base.OnCollision(other); // note: optionally check type of other gameobject for more specific reaction if using different layers if (this.Get <ReservesComponent>().Reserves-- > 0) { // just respawn for now this.Position = new Vector2(480, 440); } else { this.Destroy(); } }
public override void OnCollision(CollidableEntity other) { base.OnCollision(other); if (MovingUp) { // moving up only when shot from groundcannon this.Collection.Get <GroundCannon>().CanShoot = true; this.Destroy(); } else if (!(other is Alien || other is Mothership)) { this.Destroy(); } }
public virtual void OnCollision(CollidableEntity other) { }
public override void OnCollision(CollidableEntity other) { base.OnCollision(other); this.Destroy(); }