示例#1
0
        protected void LaserFiringMechanics(ContentManager content, List <BaseProjectile> projectiles, BaseProjectile projectile, GameTime gt)
        {
            // Firing Mechanics for a laser (LAZARS ARE SPECIAL! :D)
            if (m_isFiring)
            {
                if (m_currentTime <= 0)
                {
                    Game1.sfxList[1].Play();

                    m_currentTime         = m_baseFireRate;
                    m_projectile          = projectile;
                    m_projectile.Position = BlastPos();
                    m_projectile.Rotation = m_rot;

                    if (projectiles.Contains(m_projectile))
                    {
                        projectiles.Remove(m_projectile);
                    }

                    projectiles.Add(m_projectile);
                }
                else
                {
                    m_currentTime -= (float)gt.ElapsedGameTime.TotalSeconds;
                }
            }
            else
            {
                m_currentTime -= (float)gt.ElapsedGameTime.TotalSeconds;
            }
        }
示例#2
0
        protected void FiringMechanics(ContentManager content, List <BaseProjectile> projectiles, BaseProjectile projectile, GameTime gt)
        {
            // Firing Mechanics
            if (m_isFiring)
            {
                if (m_currentTime <= 0)
                {
                    switch (m_subIndex)
                    {
                    case 0:
                        Game1.sfxList[0].Play();
                        break;

                    case 1:
                        Game1.sfxList[0].Play();
                        break;

                    case 3:
                        Game1.sfxList[0].Play();
                        break;

                    case 4:
                        Game1.sfxList[3].Play();
                        break;

                    case 5:
                        Game1.sfxList[3].Play();
                        break;
                    }

                    m_currentTime         = m_finalFireRate;
                    m_projectile          = projectile;
                    m_projectile.Position = BlastPos();
                    m_projectile.Velocity = Vector2.Zero;
                    m_projectile.Velocity = new Vector2((float)Math.Cos(m_rot - 1.5707f), (float)Math.Sin(m_rot - 1.5707f));
                    m_projectile.Velocity.Normalize();
                    m_projectile.Velocity *= m_projectile.ProjectileSpeed;
                    m_projectile.Rotation  = m_rot;
                    projectiles.Add(m_projectile);
                }
                else
                {
                    m_currentTime -= (float)gt.ElapsedGameTime.TotalSeconds;
                }
            }
            else
            {
                m_currentTime -= (float)gt.ElapsedGameTime.TotalSeconds;
            }
        }