Exemplo n.º 1
0
 /// <summary>
 /// Release a projectile to reuse other time
 /// </summary>
 /// <param name="projectile">The projectile</param>
 public void FreeProjectile(ProjectileController projectile)
 {
     if (this.BusyProjectiles.Remove(projectile))
     {
         this.FreeProjectiles.Add(projectile);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Release a projectile to reuse other time
 /// </summary>
 /// <param name="projectile">The projectile</param>
 public void FreeProjectile(ProjectileController projectile)
 {
     if (this.BusyProjectiles.Remove(projectile))
     {
         this.FreeProjectiles.Add(projectile);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Instantiate projectiles
        /// </summary>
        /// <param name="numProjectiles">The num projectiles</param>
        private void InstantiateProjectiles(int numProjectiles)
        {
            for (int i = 0; i < numProjectiles; i++)
            {
                ProjectileController projectile = new ProjectileController();                
                this.FreeProjectiles.Add(projectile);
            }

            this.Capacity += numProjectiles;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get a new free projectile
        /// </summary>
        /// <returns>The free projectile</returns>
        public ProjectileController GetFreeProjectile()
        {
            if (this.FreeProjectiles.Count == 0)
            {
                this.InstantiateProjectiles(ProjectileCountIncrement);
            }

            ProjectileController projectile = this.FreeProjectiles[0];
            this.FreeProjectiles.RemoveAt(0);
            this.BusyProjectiles.Add(projectile);            

            return projectile;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Instantiate projectiles
        /// </summary>
        /// <param name="numProjectiles">The num projectiles</param>
        private void InstantiateProjectiles(int numProjectiles)
        {
            for (int i = 0; i < numProjectiles; i++)
            {
                ProjectileController projectile = new ProjectileController();
                this.FreeProjectiles.Add(projectile);
            }

            this.Capacity += numProjectiles;
        }