Example #1
0
        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();
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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();
            }
        }
Example #4
0
        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();
            }
        }
Example #5
0
 public virtual void OnCollision(CollidableEntity other)
 {
 }
Example #6
0
        public override void OnCollision(CollidableEntity other)
        {
            base.OnCollision(other);

            this.Destroy();
        }