コード例 #1
0
ファイル: ParticleEmitter.cs プロジェクト: Nova-Spel/Nova
        /// <summary>
        /// Creates a new particle emitter
        /// </summary>
        /// <param name="particleManager">Particle manager to use</param>
        /// <param name="particle">Particle to spawn</param>
        /// <param name="cooldownTime">Cooldown between particles (in ms)</param>
        /// <param name="spawnChance">Chance that this particle will spawn (per frame) when off cooldown</param>
        /// <param name="maxParticles">Max amount of particles</param>
        public ParticleEmitter(Vector2 position, ParticleManager particleManager, Particle particle, float cooldownTime, float spawnChance, int maxParticles, Random random)
        {
            this.position = position;
            this.particleManager = particleManager;
            this.particle = particle;
            this.cooldownTime = cooldownTime;
            this.spawnChance = spawnChance;
            this.maxParticleAmount = maxParticles;
            this.random = random;

            currentParticleAmount = 0;
            currentCooldownTime = 0.0f;

            instantSpawn = cooldownTime == 0.0f ? true : false;
        }
コード例 #2
0
ファイル: GameScreen.cs プロジェクト: Nova-Spel/Nova
        CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone(); //Behövs för att . ska användas som decimaltecken i XML

        public GameScreen()
        {
            hud = new HUD();
            player = new Player();
            planetList = new List<Planet>();
            particleManager = new ParticleManager();

            random = new Random();
            //planet = new Planet[10];
            //for(uint i=0; i<10; i++)
            //{
            //    planet[i] = new Planet();
            //}
            cam = new Camera(new Vector2(0));
            background = new Sprite[10, 10];
            for(int i=0; i<10; i++)
            {
                for(int k=0; k<10; k++)
                {
                    background[i, k] = new Sprite();
                }
            }
        }