Пример #1
0
 /// <summary>
 /// Kills the enemy preventing him from being updated or drawn
 /// </summary>
 public void death()
 {
     if(state != LifeState.Dead)
     {
         deathEffectEmitter = new Emitter(drawRect, new Vector2(0, -11f), Math.PI / 2, 0.5, 0.001, 80, 45, Player.GoreTextures, new Vector2(0f, 0.75f), new Vector2(0, 15f), 1.0);
         state = LifeState.Dead;
         //actionState = EnemyActionState.Dying;
     }
 }
Пример #2
0
        public void fireDeath()
        {
            if (ninjaLifeState == LifeState.Alive)
            {
                Point p = this.drawRect.Location;
                Metrics.Metrics.writeLine("Level: City");
                Metrics.Metrics.writeLine("Death Location: (" + p.X + "," + p.Y + ")");
                Metrics.Metrics.writeLine("Death Via Fire");
                actionState = NinjaActionState.FireDying;
                ninjaLifeState = LifeState.Dying;
                deathEffectEmitter = new Emitter(drawRect, new Vector2(0, -11f), Math.PI / 2, 0.5, 0.001, 80, 120, GoreTextures, new Vector2(0f, 0.75f), new Vector2(0, 15f), 1.0);

                MusicManager.PlaySoundEffect(SoundEffects.splat1);

            }
            // needs to go to some wait state after this
        }
Пример #3
0
        /// <summary>
        /// Kills the ninja, triggering his death animation
        /// </summary>
        /// 
        public void death()
        {
            if (ninjaLifeState == LifeState.Alive)
            {
                Point p = this.drawRect.Location;
                Metrics.Metrics.writeLine("Level: City");
                Metrics.Metrics.writeLine("Death Location: (" + p.X + "," + p.Y + ")");
                Metrics.Metrics.writeLine("Death Via Generic Death");
                ninjaLifeState = LifeState.Dead;
                deathEffectEmitter = new Emitter(drawRect, new Vector2(0, -11f), Math.PI / 2, 0.5, 0.001, 80, 120, GoreTextures, new Vector2(0f, 0.75f), new Vector2(0, 15f), 1.0);
                MusicManager.PlaySoundEffect(SoundEffects.splat1);

            }
            dialogue.showDialog(true);
            // needs to go to some wait state after this
        }
Пример #4
0
        /// <summary>
        /// Makes the ninja slide on a wall associated with the command passed in.
        /// Returns true if wall slide was successful, false otherwise
        /// </summary>
        public bool Action_WallSlide(Command c)
        {
            if (actionState == NinjaActionState.WallSliding)
                return false;
            Platform p = c.CollidesWithConnectedPlatforms(this);
            //Checks to see if the Ninja collides with Command C's list of tagged platforms
            if (p != null)
            {
                if (velocity.X > 0)
                    wallSlideFacingLeft = false;
                else
                    wallSlideFacingLeft = true;

                actionState = NinjaActionState.WallSliding;
                WallSlidePlatform = p;

                //create rectangle for emission based on ninja's direction
                int xvar;
                if (!wallSlideFacingLeft)
                    xvar = drawRect.Right - 10;
                else
                    xvar = drawRect.Left;
                Rectangle b = new Rectangle(xvar, drawRect.Bottom, 10, 10);

                //create the emitter
                wallSlideSparkEmitter = new Emitter(b, //bounding box of the emitter
                    //new Vector2((float)(facingLeft ? Math.Tan(Math.PI / 18) * NinjaWallSlideSpeed : Math.Tan(Math.PI / 18) * -NinjaWallSlideSpeed),
                    new Vector2(wallSlideFacingLeft ? 0.6215f : -0.6215f, (float)-NinjaWallSlideSpeed), //starting velocity vector (roughly 100 or 80 degrees depending which way ninja is facing)
                    Math.PI / 18,           //maximum angle (in radians) a particle's vector may deviate from the specified one
                    0.3,
                    0.01,                   //intensity (particles are generated at a frequency of 30 frames / thisvalue)
                    300,                    //maximum number of particles
                    30,                     //particle lifespan, in frames
                    SparkTextures,          //Linked list of textures this emitter can use when generating particles
                    new Vector2(0, 1.7f),    //A delta vector acting on particles; in this case, it's working as a lighter form of gravity
                    new Vector2(0, 8f),     //a delta vector cutoff; in this case, it's the max velocity
                    0.2);                   //the fraction of particles generated by this emitter that will employ the above delta vectors to modify their velocity

                wallSlideSparkEmitter.particlesFade = true;
                return true;
            }
            return false;
        }
Пример #5
0
        private void UpdateWarpAnimation()
        {
            //old Mega Man style warp in code

            /*
            Rectangle modDrawRect = ScreenCoordinateDrawFrame();
            if (!warpAnimationCompleted)
            {

                int centerX = modDrawRect.X + (modDrawRect.Width / 2);

                if (warpY < modDrawRect.Top)
                {
                    warpDrawFrame = new Rectangle(centerX, warpY, 2, 80);
                    warpDrawColor = Color.Purple;
                    warpY += 30;
                    if (warpY >= modDrawRect.Top)
                    {
                        Rectangle r = drawRect;
                        r.Y = r.Bottom + 1;
                        r.Height = 1;
                        warpEffectEmitter = new Emitter(r, new Vector2(0f, -3f), Math.PI / 2, 0.5, 0.005, 90, 60, TitleScreen.emitterArt1);
                        warpEffectEmitter.particlesFade = true;
                    }
                }
                else if (2 * warpWidth < modDrawRect.Width)
                {
                    warpWidth += 2;
                    warpDrawFrame = new Rectangle(centerX - warpWidth, modDrawRect.Y, warpWidth * 2, 80);
                    warpDrawColor = Color.White;
                }
                else
                {
                    EndWarpAnimation();
                }
                */

            //fade in from black
            if (!warpAnimationCompleted)
            {
                if(warpFramesRemaining == 0)
                    EndWarpAnimation();
                else if (warpFramesRemaining == warpFramesMaximum)
                {
                    Rectangle r = drawRect;
                    r.Y = r.Bottom + 1;
                    r.Height = 1;
                    warpEffectEmitter = new Emitter(r, new Vector2(0f, -3f), Math.PI / 2, 0.8, 0.001, 140, 60, TitleScreen.emitterArt1);
                    warpEffectEmitter.particlesFade = true;
                    warpFramesRemaining--;
                }
                else{

                    if(warpFramesRemaining <= warpFramesMaximum / 2){
                        float value = ((float)((warpFramesMaximum/2) - warpFramesRemaining) / (warpFramesMaximum/2));
                        warpDrawColor = new Color(value, value, value, 1);
                    }
                    warpFramesRemaining--;

                }
            }
        }
Пример #6
0
        /// <summary>
        /// killed by an enemy object
        /// </summary>
        public void villainDeath()
        {
            if (ninjaLifeState == LifeState.Alive)
            {
                Point p = this.drawRect.Location;
                Metrics.Metrics.writeLine("Level: City");
                Metrics.Metrics.writeLine("Death Location: (" + p.X + "," + p.Y + ")");
                Metrics.Metrics.writeLine("Death Via Villain");
                actionState = NinjaActionState.VillainDying;
                ninjaLifeState = LifeState.Dying;
                Rectangle r = drawRect;
                r.X += 24;
                r.Y += 37;
                r.Width = 1;
                r.Height = 1;
                deathEffectEmitter = new Emitter(r, new Vector2(facingLeft? 15f: -15f, 0f), Math.PI / 6, 0.5, 0.001, 80, 120, BloodTextures, new Vector2(0f, 0.75f), new Vector2(0, 15f), 1.0);

                MusicManager.PlaySoundEffect(SoundEffects.splat1);

            }
            // needs to go to some wait state after this
        }