コード例 #1
0
ファイル: ChargedLaser.cs プロジェクト: mrwo226/GameProject
 public ChargedLaser(Game game, ProjectileAlignment alignment)
     : base()
 {
     this.game = (Game1)game;
     Speed = 15f;
     Alignment = alignment;
     LoadContent();
 }
コード例 #2
0
        /// <summary>
        /// Creates a new projectile for the level based on its type.  It's position is updated and then added to the list of projectiles in the game.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        public void CreateProjectile(ProjectileType type, Vector2 spawnPosition, Game game, ProjectileAlignment alignment)
        {
            Projectile newProjectile = null;
            switch (type)
            {
                case ProjectileType.BasicLaser:
                    newProjectile = new BasicLaser(game, alignment);
                    break;
                case ProjectileType.ChargedLaser:
                    newProjectile = new ChargedLaser(game, alignment);
                    break;
            }
            newProjectile.Position = spawnPosition;

            ProjectileList.Add(newProjectile);
        }