public Explosion(Hero h, Enemy e)
        {
            splash = new XNACS1Circle(e.getPosition().Center, splashRadius);
            timer = new Timer(duration);
            splash.Color = h.getColor();
            splash.Visible = false;
            splash.RemoveFromAutoDrawSet();

            emitter = new ExplosionEmitter(e.getPosition().Center, duration, 0.6f, h.getColor());
            emitter.DrawHalo(20);
            emitter.AutoRemoveDeadParticles = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Overrides the RectangleWithPhysics CollideWithCircle function so
        /// that a Receptacle does not really collide with Money, but rather,
        /// removes the Money and counts it as collected.
        /// </summary>
        /// <param name="circle"></param>
        protected override void CollideWithCircle(XNACS1Circle circle)
        {
            /*Record as caught*/
            ++this.coinsCaught;

            /*Play sound to make clear that coin is in*/
            if(circle.IsInAutoDrawSet())
                XNACS1Base.PlayACue("11Coin");  //Super Mario Bros. SFX; REPLACE!

            /*Remove coin from draw set; it has been safely collected*/
            circle.RemoveFromAutoDrawSet();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Overrides the RectangleWithPhysics CollideWithCircle function so
        /// that a Receptacle does not really collide with Money, but rather,
        /// removes the Money and counts it as collected.
        /// </summary>
        /// <param name="circle"></param>
        protected override void CollideWithCircle(XNACS1Circle circle)
        {
            /*Record as caught*/
            ++this.coinsCaught;

            // increase size
            Vector2 prevSize = this.Size;
            this.Size *= 1.02f;

            // now shift object up so it's bottom edge remains the same on screen regardless of size.
            float vertDisp = (this.Size.Y - prevSize.Y) / 2;
            this.CenterY += vertDisp;

            /*Play sound to make clear that coin is in*/
            if (circle.IsInAutoDrawSet())
            {
                int soundToPlay = XNACS1Base.RandomInt(1, 5);

                switch (soundToPlay)
                {
                    case(1):
                        XNACS1Base.PlayACue("Coin1");
                        break;
                    case (2):
                        XNACS1Base.PlayACue("Coin2");
                        break;
                    case (3):
                        XNACS1Base.PlayACue("Coin3");
                        break;
                    case (4):
                        XNACS1Base.PlayACue("Coin4");
                        break;
                    default:
                        XNACS1Base.PlayACue("Coin5");
                        break;
                }

            }

            /*Remove coin from draw set; it has been safely collected*/
            circle.RemoveFromAutoDrawSet();
        }