Ejemplo n.º 1
0
        public void FireMissiles(Vector2 inPosition)
        {
            if (missilesLeft > 0)
            {
                missilesLeft--;
                origScale = origScale + (aimScale - origScale) * amount;
                aimScale = ((float)missilesLeft / (float)Game1.gammgr.saveGameData.maxMissiles) * (Game1.gammgr.saveGameData.maxMissiles / 5);
                amount = 0;
                for (int i = 0; i < 2; i++)
                {
                    Bullet b;
                    if (Game1.gammgr.unusedBulletList.Count == 0)
                    {
                        b = new Bullet();
                    }
                    else
                    {
                        b = Game1.gammgr.unusedBulletList[0];
                        Game1.gammgr.unusedBulletList.Remove(b);
                    }
                    b.Setup(new Vector2(0.001f, -0.03f + (i * 0.06f)), inPosition, true, true);

                    Game1.gammgr.playerBulletList.Add(b);
                }

                Game1.pclmgr.createEffect(ParticleEffect.missileBar, new Vector2(0.5f - (((float)missilesLeft / (float)Game1.gammgr.saveGameData.maxMissiles) * 0.01f), 0.9f), Color.White);
                Game1.pclmgr.createEffect(ParticleEffect.missileBar, new Vector2(0.5f + (((float)missilesLeft / (float)Game1.gammgr.saveGameData.maxMissiles) * 0.01f), 0.9f), Color.White);
            }
        }
Ejemplo n.º 2
0
        public void update(Vector2 inPosition, List<Vector2> pbPos)
        {
            if (health< 0.01f)
            {
                isDead = true;
                AwardsManager.shipDead = true;
            }

            if (healTime < healSwit)
            {
                healTime++;
            }
            else
            {
                if (health < Game1.gammgr.saveGameData.buffHealth)
                {
                    health += 0.1f;
                }
                else if (health > Game1.gammgr.saveGameData.buffHealth)
                {
                    health = (float)Game1.gammgr.saveGameData.buffHealth;
                }
            }

            c = new Color(Vector3.Lerp(topColor.ToVector3(), botColor.ToVector3(), position.Y));
            if (shieldColor < 1)
            {
                shieldColor += 0.1f;
                shield = new Color(shieldColor, shieldColor, shieldColor);
                painColor = new Color(0, 0, 0, 1 - shieldColor);
            }
            else
            {
                shield = Color.White;
                painColor = Color.Transparent;
            }

                //Movement Code!
                accel *= accelmod;
                tV2 = (inPosition - position);
                tV2.Normalize();
                tV2 *= 0.75f;
                accel += tV2 * maxSpeed;
                System.Console.Write("hi");

                for (int i = 0; i < pbPos.Count; i++)
                {
                    if (Vector2.Distance(pbPos[i], position) < 0.025f - ((float)Game1.gammgr.saveGameData.totalPlayerBuffs * 0.001f))
                    {
                        if (pbPos[i] != position)
                        {
                            accel -= (pbPos[i] - position) * (0.1f - Vector2.Distance(pbPos[i], position));
                        }
                    }
                }

                position += accel;
                //new new new Bullet Shotting

                //if (Game1.inpmgr.playerOneInput.A == expButtonState.Pressed || Game1.inpmgr.playerOneInput.A == expButtonState.Held ||
                //    Game1.inpmgr.playerOneInput.rightTrigger > 0.25f)
                //{
                    shootingTimer += Game1.gammgr.saveGameData.playerShootspeed;

                    if (shootingTimer >= 3)
                    {
                        shootingTimer = 0;
                        Bullet b;
                        if (Game1.gammgr.unusedBulletList.Count == 0)
                        {
                            b = new Bullet();
                        }
                        else
                        {
                            b = Game1.gammgr.unusedBulletList[0];
                            Game1.gammgr.unusedBulletList.Remove(b);
                        }
                        b.Setup(new Vector2(0.006f + (Game1.gammgr.saveGameData.playerShootspeed / 50), 0), position, true, false);

                        Game1.gammgr.playerBulletList.Add(b);
                        Game1.sndmgr.playSound(SFX.playerShot);
                    }
                //}

                rocketTimer += (float)(Game1.gammgr.r.NextDouble() * 0.05);

                if (Game1.inpmgr.playerOneInput.B == expButtonState.Pressed)
                    rocketTimer += 0.005f;

                if (rocketTimer >= 2)
                {
                    if (Game1.inpmgr.playerOneInput.A == expButtonState.Pressed ||
                        Game1.inpmgr.playerOneInput.A == expButtonState.Held ||
                        Game1.inpmgr.playerOneInput.B == expButtonState.Pressed ||
                        Game1.inpmgr.playerOneInput.B == expButtonState.Held ||
                        Game1.inpmgr.playerOneInput.leftTrigger > 0.25f ||
                        Game1.inpmgr.playerOneInput.rightTrigger > 0.25f)
                    {
                        rocketTimer = 0;
                        Game1.gammgr.mb.FireMissiles(position);
                        AwardsManager.missileshot = true;
                    }
                }

            if (pauseTime != 0)
            {
                pauseTime--;
                shieldColor = 0.25f;
            }
        }