예제 #1
0
        public void LoadContent(ContentManager content)
        {
            _texDude = content.Load<Texture2D>("dude");

            for (int i = 0; i < MAX_PROJECTILES; i++)
                Projectiles[i] = new Projectile(_texDude);
        }
예제 #2
0
        public void CalculateExplosion(Projectile p)
        {
            GameSession.Instance.ParticleController.AddExplosion(p.Position);
            AudioController.PlaySFX("explode", 1f * (GameSession.Instance.Map.Zoom * 1.5f), ((float)GameSession.Instance.DudeController.Rand.NextDouble() / 1f) - 0.5f, ((2f / GameSession.Instance.Viewport.Width) * p._screenRelativePosition.X) - 1f);
            foreach (Dude d in GameSession.Instance.DudeController.Dudes)
            {
                if (!d.Active) continue;
                if (d.Team==p.Team) continue;

                float dist = (p.Position - d.HitPosition).Length();
                if ((int)dist <= p.Damage)
                {
                    d.Hit(p.Damage - (int)dist);
                    GameSession.Instance.ParticleController.AddGSW(d.HitPosition, (new Vector2(0, -(p.Damage - dist)*0.1f)), d.IsShielded);
                }
            }
        }