示例#1
0
        public void AddHeal(NPC n)
        {
            int tempMode = 0;

            switch (n.GetAffiliation())
            {
            case NPC.AffliationTypes.blue:
                tempMode = 1;
                break;

            case NPC.AffliationTypes.green:
                tempMode = 2;
                break;

            case NPC.AffliationTypes.yellow:
                tempMode = 3;
                break;
            }

            AddParticle("Effects/particle_heal", managers.GetRandom().Next(5), tempMode, n.GetOriginPosition(),
                        PathHelper.Direction((float)(managers.GetRandom().NextDouble() * MathHelper.TwoPi)) * 50, 2, 0.03f, 1, 0);

            managers.GetAudioManager().Play(AudioManager.HEAL_SOUND, AudioManager.RandomVolume(managers),
                                            AudioManager.RandomPitch(managers), 0, false);
        }
示例#2
0
 protected override void Shoot(ManagerHelper mH)
 {
     mH.GetNPCManager().Add(new Bomber(BomberOrigin(mH), affiliation, target, mH));
     calledIn = 0;
     mH.GetAudioManager().Play(AudioManager.STATIC, AudioManager.RandomVolume(mH),
                               AudioManager.RandomPitch(mH), 0, false);
 }
示例#3
0
        protected override bool ProjectileCheck(ManagerHelper mH)
        {
            if (health <= 0)
            {
                return(true);
            }

            else
            {
                foreach (Projectile p in mH.GetProjectileManager().GetProjectiles())
                {
                    if (p.GetDrawTime() > 0 && p.GetAffiliation() != affiliation &&
                        CollisionHelper.IntersectPixelsSimple(this, p) != new Vector2(-1))
                    {
                        lastDamagerDirection = PathHelper.DirectionVector(GetOriginPosition(), p.GetOriginPosition());
                        counter = 0;

                        float test = p.GetRotation() + MathHelper.Pi;
                        if (test > MathHelper.TwoPi)
                        {
                            test -= MathHelper.TwoPi;
                        }

                        if (MathHelper.Distance(test, rotation) > (MathHelper.Pi * 5 / 6))
                        {
                            ChangeHealth(-1 * p.GetDamage(), p.GetCreator());
                            mH.GetParticleManager().AddBlood(this);

                            if (health <= 0)
                            {
                                return(true);
                            }
                        }
                        else
                        {
                            Vector2 knockback = new Vector2((float)(p.velocity.X * .05), (float)(p.velocity.Y * .05));
                            accelerations.Add(knockback);
                            mH.GetAudioManager().Play(AudioManager.JUGGERNAUT_RICOHET, (float).05, 0, 0, false);
                        }

                        p.SetDrawTime(0);
                    }

                    else
                    {
                        counter += mH.GetGameTime().ElapsedGameTime.TotalSeconds;
                    }

                    if (counter > 2)
                    {
                        counter = 0;
                        lastDamagerDirection = Vector2.Zero;
                    }
                }
            }

            return(false);
        }
示例#4
0
        public void Set(Vector2 p, float r, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            affiliation = aT;
            rotation    = r;
            position    = p;

            lifeTimer = 2;

            mH.GetAudioManager().Play(AudioManager.SPARK, (float)mH.GetRandom().NextDouble() / 4 + 0.5f, AudioManager.RandomPitch(mH), 0, false);
        }
示例#5
0
        protected override void Shoot(ManagerHelper mH)
        {
            Vector2 tempPos = PathHelper.Direction(rotation + MathHelper.PiOver2) * new Vector2(10);

            mH.GetProjectileManager()
            .AddProjectile(ProjectileManager.ROCKET, GetOriginPosition() + tempPos, this,
                           PathHelper.Direction(rotation) * 300, 100, true, true, 5);

            mH.GetAudioManager().Play(AudioManager.SPECIALIST_SHOOT, AudioManager.RandomVolume(mH),
                                      AudioManager.RandomPitch(mH), 0, false);
        }
示例#6
0
        protected virtual void Shoot(ManagerHelper mH)
        {
            Vector2 tempPos = PathHelper.Direction(rotation + MathHelper.PiOver2) * new Vector2(10);

            mH.GetProjectileManager()
            .AddProjectile(ProjectileManager.STANDARD, GetOriginPosition() + tempPos, this,
                           PathHelper.Direction(rotation + (float)mH.GetRandom().NextDouble() / 8 - 0.0625f) * 400, 25,
                           false, true, 5);

            mH.GetAudioManager().Play(AudioManager.STANDARD_SHOOT, AudioManager.RandomVolume(mH),
                                      AudioManager.RandomPitch(mH), 0, false);
        }
示例#7
0
        public Bomber(Vector2 p, AffliationTypes a, NPC t, ManagerHelper mH)
            : base("", p)
        {
            hasBombed      = false;
            drawTarget     = true;
            targetPosition = t.GetOriginPosition();
            health         = 100;
            movementSpeed  = 1000;
            affiliation    = a;

            //Set up rotation
            rotation = PathHelper.Direction(GetOriginPosition(), targetPosition);

            //Set up direction
            float dir = PathHelper.Direction(GetOriginPosition(), t.GetOriginPosition());

            velocity = new Vector2(DWMath.Cos(dir), DWMath.Sin(dir)) * movementSpeed;

            //Set up path
            path = new Path();
            path.Add(targetPosition, mH);

            string targeAsset = "";

            //Set up affiliation
            switch (a)
            {
            case AffliationTypes.red:
                targeAsset = "Dots/Red/targetRed";
                asset      = "Dots/Red/bomber_red";
                break;

            case AffliationTypes.blue:
                targeAsset = "Dots/Blue/targetBlue";
                asset      = "Dots/Blue/bomber_blue";
                break;

            case AffliationTypes.green:
                targeAsset = "Dots/Green/targetGreen";
                asset      = "Dots/Green/bomber_green";
                break;

            case AffliationTypes.yellow:
                targeAsset = "Dots/Yellow/targetYellow";
                asset      = "Dots/Yellow/bomber_yellow";
                break;
            }

            targetSprite = new Sprite(targeAsset, targetPosition);

            mH.GetAudioManager().Play(AudioManager.PLANE, AudioManager.RandomVolume(mH),
                                      AudioManager.RandomPitch(mH), 0, false);
        }
示例#8
0
        public void Set(Vector2 p, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            originPosition = p;
            position       = p - origin;
            affiliation    = aT;
            animateTimer   = 0;
            rotation       = (float)(Math.PI * 2 * mH.GetRandom().NextDouble());
            splash.SetOriginPosition(originPosition);
            splash.position = position;

            mH.GetAudioManager().Play(AudioManager.WATER, (float)mH.GetRandom().NextDouble() / 4 + 0.5f, AudioManager.RandomPitch(mH), 0, false);
        }
示例#9
0
        public void Set(Vector2 p, int d, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            base.Set(asset, p, Vector2.Zero, 0.1f, 0, 0, 0.5f, mH);

            existanceTime = 0.1f;
            affiliation   = aT;
            creator       = null;
            damage        = d;
            exploaded     = false;

            mH.GetAudioManager().Play(AudioManager.EXPLOSION, AudioManager.RandomVolume(mH), AudioManager.RandomPitch(mH), 0, false);
        }
示例#10
0
        public void Set(Vector2 p, int d, NPC n, ManagerHelper mH)
        {
            base.Set(asset, p, Vector2.Zero, 0.1f, 0, 0, 0.5f, mH);

            existanceTime = 0.1f;
            affiliation   = n.GetAffiliation();
            creator       = n;
            damage        = d;
            exploaded     = false;

            originPosition = position + origin;

            mH.GetAudioManager().Play(AudioManager.EXPLOSION, AudioManager.RandomVolume(mH), AudioManager.RandomPitch(mH), 0, false);
        }
示例#11
0
        public void Set(Vector2 p, Vector2 direction, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            frameCounter = 0;
            scale        = 1;
            doomedDots.Clear();
            dotsSetOnFire.Clear();
            affiliation    = aT;
            frameIndex     = 0;
            originPosition = p;
            position       = p - origin;
            velocity       = new Vector2(300 * direction.X, 300 * direction.Y);

            mH.GetAudioManager().Play(AudioManager.FIREBALL, (float)mH.GetRandom().NextDouble() / 4 + 0.75f, AudioManager.RandomPitch(mH), 0, false);
        }
示例#12
0
        public void Set(Vector2 p, NPC.AffliationTypes aT, ManagerHelper mH)
        {
            position = p;

            animateTime = 0.3f;
            timer       = 0;

            health = 150;

            affiliation = aT;

            LoadContent(mH.GetTextureManager());

            mH.GetAudioManager().Play(AudioManager.LARGE_ROCK, (float)mH.GetRandom().NextDouble() / 4 + 0.75f, AudioManager.RandomPitch(mH), 0, false);

            for (int i = 0; i < 10; i++)
            {
                mH.GetParticleManager().AddStandardSmoke(origin + position, 64);
            }
        }
示例#13
0
 protected override void ShootSound(ManagerHelper mH)
 {
     mH.GetAudioManager().Play(AudioManager.COMMANDER_SHOOT, 0.90f,
                               (float)(mH.GetRandom().NextDouble() * -0.25), 0, false);
 }
示例#14
0
 protected override void GrenadeSound(ManagerHelper mH)
 {
     mH.GetAudioManager().Play(AudioManager.COMMANDER_GRENADE, 0.90f,
                               AudioManager.RandomPitch(mH), 0, false);
 }
示例#15
0
 protected virtual void ShootSound(ManagerHelper mH)
 {
     mH.GetAudioManager().Play(AudioManager.STANDARD_SHOOT, AudioManager.RandomVolume(mH),
                               AudioManager.RandomPitch(mH), 0, false);
 }
示例#16
0
 protected virtual void GrenadeSound(ManagerHelper mH)
 {
     mH.GetAudioManager().Play(AudioManager.GRENADE_SHOOT, AudioManager.RandomVolume(mH),
                               AudioManager.RandomPitch(mH), 0, false);
 }
示例#17
0
 protected virtual void ShotgunSound(ManagerHelper mH)
 {
     mH.GetAudioManager().Play(SHOTGUN_SHOOT, AudioManager.RandomVolume(mH),
                               (float)(mH.GetRandom().NextDouble() * -0.25), 0, false);
 }