Пример #1
0
        // Internal handlnig of adding sprite
        private void addInternal(SpriteActor sprite)
        {
            sprites.Add(sprite);
            if (sprite is Bullet)
            {
                bullets.Add(sprite as Bullet);
            }
            else if
            (sprite is Enemy)
            {
                enemies.Add(sprite as Enemy);
            }
            else if (sprite is Pickup)
            {
                pickups.Add(sprite as Pickup);
            }
            else if (sprite is Player)
            {
                player = sprite as Player;
            }

            if (sprite is Enemy)
            {
                if (sprite is Boss)
                {
                    boss = sprite as Boss;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Create a basic bullet
 /// </summary>
 /// <param name="tex">bullet texture</param>
 /// <param name="position">initial position</param>
 /// <param name="velocity">inital velocity</param>
 /// <param name="src">source from which this button was spawned (e.g. player, enemy, etc.)</param>
 /// <param name="autoBB">automatically set BB</param>
 public Bullet(Texture2D tex, Vector2 position, Vector2 velocity, SpriteActor src, bool autoBB) : base(tex, position, velocity)
 {
     source = src;
     if (!autoBB)
     {
         sprite.setBB(spriteSize.X / 2 - (Resources.Bullet.Width / 2), spriteSize.Y / 2 - (Resources.Bullet.Height / 2), Resources.Bullet.Width, Resources.Bullet.Height);
     }
     sprite.boundingSphereRadius = 15;
 }
Пример #3
0
 /// <summary>
 /// Add a sprite actor to the sprite manager to later be updated and drawn
 /// </summary>
 /// <param name="sprite">SpriteActor object to be added</param>
 public void addSpriteActor(SpriteActor sprite)
 {
     // If we're currently working on our list of sprites, add them to a temp
     if (updating)
     {
         tempList.Add(sprite);
     }
     else
     {
         addInternal(sprite);
     }
 }
Пример #4
0
 // Checks if two sprites are colliding, uses internal RC_Framework collision handling
 private bool isColliding(SpriteActor s1, SpriteActor s2)
 {
     return(s1.sprite.collision(s2.sprite));
 }