예제 #1
0
        public Particle Clone()
        {
            Particle tempParticle = new Particle();

            tempParticle.Position.X = Position.X;
            tempParticle.Position.Y = Position.Y;

            tempParticle.Texture = Texture;
            tempParticle.SourceRectangle = SourceRectangle;

            tempParticle.Direction = Direction;
            tempParticle.Alpha = Alpha;
            tempParticle.Speed = Speed;
            tempParticle.Scale = Scale;
            tempParticle.Angle = Angle;

            tempParticle.DeltaSpeed = DeltaSpeed;
            tempParticle.DeltaAlpha = DeltaAlpha;
            tempParticle.DeltaScale = DeltaScale;
            tempParticle.DeltaAngle = DeltaAngle;

            tempParticle.ParticleColor = ParticleColor;

            return tempParticle;
        }
예제 #2
0
        public MotherBombBullet(Vector2 startingPoint, float speed, float direction, float maxDistance)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 400;
            this.originalSpeed = speed;
            this.baseSpeed = 15;
            this.grenadeDistance = 0.3f * OGE.WorldCamera.Width;
            this.texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\Bullets\RedGrenade");
            this.baseMask = new HitboxMask(texture.Height, texture.Height, texture.Height / 2, texture.Height / 2);

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(255, 60, 50);
            particlePrototype.DeltaScale = -0.1f;
            particlePrototype.DeltaSpeed = -0.1f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 2f;
            this.trailParticleGenerator.Scale = 0.5f;

            this.ExplosionColor = new Color(255, 60, 50);
            this.ExplosionRadius = 180;
            this.ExplosionPower = 20;
        }
예제 #3
0
        public BaseExplosion(Vector2 position, Color explosionColor, float radius)
        {
            this.Position = position;
            this.radius = radius;
            this.AdditiveWhite = 0.2f;
            this.FriendlyExplosion = false;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = explosionColor;
            particlePrototype.DeltaScale =  0.03f;
            particlePrototype.DeltaAlpha = -0.03f;

            this.circleGenerator = new CircleParticleGenerator(OGE.CurrentWorld.ExplosionEffectSystem, particlePrototype);
            this.circleGenerator.AngleDisplacement = 20;
            this.circleGenerator.InterDistance = 10;
            this.circleGenerator.NumberOfCircles = (int)MathHelper.Clamp((radius / 100), 1, 4);
            this.circleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.circleGenerator.Speed = 4f;

            this.circleGenerator.GenerateParticles(Position);
            OGE.CurrentWorld.LightingEffectSystem.GenerateLightSource(position, new Vector2(2 * radius, 2 * radius), explosionColor, -0.01f);
            OGE.CurrentWorld.AdditiveWhite.Alpha += AdditiveWhite;
            OGE.WorldCamera.ShackCamera(10, 0.25f);

            this.EntityCollisionType = CollisionType.Explosion;

            SoundManager.EmitterPosition = Position;
            SoundManager.PlaySFX("explosion");

            this.removalAlarm = new Alarm(0.08f, TweenType.OneShot, new AlarmFinished(RemoveEntity));
            AddTween(removalAlarm, true);
        }
예제 #4
0
        public void AddFractionalParticle(Vector2 position, Particle prototype)
        {
            Particle particle = prototype.Clone();
            particle.Position = position;
            particle.Angle = particle.Direction;

            particles.Add(particle);
        }
예제 #5
0
        public void AddParticle(Vector2 position, Particle prototype, ParticleTextureType textureType)
        {
            Particle particle = prototype.Clone();
            particle.Texture = particleTextures[textureType];
            particle.Position = position;
            particle.Angle = particle.Direction;

            particles.Add(particle);
        }
 public TrailParticleGenerator(ParticleEffectSystem particleSystem, Particle particlePrototype)
     : base(particleSystem, particlePrototype)
 {
     Angle = 0;
     AngleDisplacement = 15;
     NumberOfParticles = 2;
     Speed = 5;
     Scale = 1;
     ParticleTexture = ParticleTextureType.BlurredCircle;
 }
        public FractionalParticleGenerator(ParticleEffectSystem particleSystem, Particle particlePrototype, int numberOfFractions = 20)
            : base(particleSystem, particlePrototype)
        {
            AngleDisplacement = 20;
            Speed = 5;
            Scale = 1;

            NumberOfCircles = 1;
            InterDistance = 20;

            this.numberOfFractions = numberOfFractions;
        }
        public CircleParticleGenerator(ParticleEffectSystem particleSystem, Particle particlePrototype)
            : base(particleSystem, particlePrototype)
        {
            AngleDisplacement = 15;
            StartingDistance = 0;
            Speed = 5;
            Scale = 1;
            ParticleTexture = ParticleTextureType.BlurredCircle;

            NumberOfCircles = 1;
            InterDistance = 20;
        }
예제 #9
0
        public UziBullet(Vector2 startingPoint, float speed, float direction, float maxDistance)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 10;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(255, 250, 50);
            particlePrototype.DeltaScale = -0.03f;
            particlePrototype.DeltaAlpha = -0.03f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 10f;
            this.trailParticleGenerator.Scale = 0.25f;
        }
예제 #10
0
        public override void DestroyBulletCollision(BaseEntity entity)
        {
            Particle prototype = new Particle();
            prototype.DeltaScale = -0.03f;
            prototype.DeltaSpeed = -0.02f;
            prototype.DeltaAngle = 5f;

            FractionalParticleGenerator fractionalGenerator = new FractionalParticleGenerator(OGE.CurrentWorld.ExplosionEffectSystem,
                prototype, 4);
            fractionalGenerator.Speed = 5;
            fractionalGenerator.NumberOfCircles = 1;
            fractionalGenerator.AngleDisplacement = 30;
            fractionalGenerator.FractionTexture = CurrentImages[0].Texture;
            fractionalGenerator.GenerateParticles(Position);

            base.DestroyBulletCollision(entity);
        }
예제 #11
0
        public XenaBullet(Vector2 startingPoint, float speed, float direction, float maxDistance)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 25;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(150, 255, 130);
            particlePrototype.DeltaScale = -0.005f;
            particlePrototype.DeltaAlpha = -0.01f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.AngleDisplacement = 1;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 5f;
            this.trailParticleGenerator.Scale = 0.1f;
        }
예제 #12
0
        public HackintoshEnemy()
            : base(new Color(50,50,50))
        {
            InsideScreen = true;

            maxSpeed = SPEED_UNIT;
            acceleration = 0f;

            direction = random.Next(0);
            rotationSpeed = 0f;

            health = 300f;
            damage = 0f;
            score = 500;

            enemyStatus = EnemyStatus.Enterance;

            CurrentImages.Add(new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Enemies\Hackintosh")));
            CurrentImages[0].CenterOrigin();
            CurrentImages[0].Scale = 0;

            AddCollisionMask(new HitboxMask(CurrentImages[0].Width, CurrentImages[0].Height,
                CurrentImages[0].OriginX, CurrentImages[0].OriginY));

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = enemyColor;
            particlePrototype.DeltaScale = -0.08f;
            particlePrototype.DeltaAlpha = -0.08f;

            this.circleGenerator = new CircleParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.circleGenerator.AngleDisplacement = 45;
            this.circleGenerator.InterDistance = 5;
            this.circleGenerator.StartingDistance = 5;
            this.circleGenerator.NumberOfCircles = 1;
            this.circleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.circleGenerator.Speed = 4f;
            this.circleGenerator.Scale = 0.1f;

            this.generateAlarm = new Alarm(3f, TweenType.Looping, new AlarmFinished(GenerateVirus));
            AddTween(generateAlarm, true);
        }
예제 #13
0
        public GrenadeBullet(Vector2 startingPoint, float speed, float direction, float maxDistance)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 400;
            this.originalSpeed = speed;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(255, 60, 50);
            particlePrototype.DeltaScale = -0.1f;
            particlePrototype.DeltaSpeed = -0.1f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 2f;
            this.trailParticleGenerator.Scale = 0.5f;

            this.ExplosionColor = new Color(255, 60, 50);
            this.ExplosionRadius = 180;
            this.ExplosionPower = 20;
        }
예제 #14
0
        public BulletGrenadeBullet(Vector2 startingPoint, float speed, float direction, float maxDistance)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 0;
            this.originalSpeed = speed;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(255, 250, 50);
            particlePrototype.DeltaScale = -0.1f;
            particlePrototype.DeltaSpeed = -0.1f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 2f;
            this.trailParticleGenerator.Scale = 0.5f;

            this.texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\Bullets\YellowBullet");
            this.baseMask = new HitboxMask(texture.Height, texture.Height, texture.Height / 2, texture.Height / 2);
            this.bulletSpeed = 15;
        }
예제 #15
0
        public BaseObject(double timeTillRemove, Color removalColor)
        {
            this.removalAlarm = new Alarm(timeTillRemove, TweenType.OneShot, new AlarmFinished(RemoveEntity));
            AddTween(removalAlarm, true);
            this.removalColor = removalColor;

            this.notifingAlarm = new Alarm(0.8f, TweenType.Looping, GenerateNotifier);
            AddTween(this.notifingAlarm, true);

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = removalColor;
            particlePrototype.DeltaScale = 0.03f;
            particlePrototype.DeltaAlpha = -0.03f;

            this.circleGenerator = new CircleParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.circleGenerator.AngleDisplacement = 30;
            this.circleGenerator.NumberOfCircles = 1;
            this.circleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.circleGenerator.Speed = 1f;
            this.circleGenerator.Scale = 0.5f;

            EntityCollisionType = CollisionType.Object;
        }
예제 #16
0
        public SpikeBullet(Vector2 startingPoint, float speed, float direction, float maxDistance, float timeToRemove = 3)
            : base(startingPoint, speed, direction, maxDistance)
        {
            this.damage = 10;
            this.originalSpeed = speed;

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(255, 60, 50);
            particlePrototype.DeltaScale = -0.1f;
            particlePrototype.DeltaSpeed = -0.1f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.Angle = direction + 180;
            this.trailParticleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.trailParticleGenerator.Speed = 2f;
            this.trailParticleGenerator.Scale = 0f;

            this.ExplosionColor = new Color(255, 60, 50);
            this.ExplosionRadius = 20;
            this.ExplosionPower = 1;

            this.removalAlarm = new Alarm(timeToRemove, TweenType.OneShot, () => { OGE.CurrentWorld.RemoveEntity(this); });
            AddTween(removalAlarm, true);
        }
예제 #17
0
        public HackintoshBoss()
            : base(new Vector2(OGE.CurrentWorld.Dimensions.X / 2, OGE.CurrentWorld.Dimensions.Y / 2 - 200))
        {
            this.status = BossState.Wait;

            Texture2D texture = OGE.Content.Load<Texture2D>(@"Graphics\Entities\Bosses\HackintoshBoss");

            this.images.Add(BossState.Wait, new Image(texture));

            foreach (Image image in this.images.Values)
            {
                image.CenterOrigin();
            }

            this.actions.Add(BossState.Wait, Wait);

            this.maxHealth = 15000;
            this.health = this.maxHealth;

            this.acceleration = 0;
            this.Direction = 90;
            this.maxSpeed = 0;
            this.speed = 0;
            this.slidingFactor = 0;
            this.freezeResistance = 1f;

            this.damage = 0;
            this.enemyColor = new Color(255, 255, 80);
            this.score = 5000;
            this.CurrentImage = images[status];

            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = enemyColor;
            particlePrototype.DeltaScale = -0.08f;
            particlePrototype.DeltaAlpha = -0.08f;

            this.circleGenerator = new CircleParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.circleGenerator.AngleDisplacement = 45;
            this.circleGenerator.InterDistance = 5;
            this.circleGenerator.StartingDistance = 15;
            this.circleGenerator.NumberOfCircles = 1;
            this.circleGenerator.ParticleTexture = ParticleTextureType.BlurredCircle;
            this.circleGenerator.Speed = 4f;
            this.circleGenerator.Scale = 1f;

            this.waitAlarm = new Alarm(waitingTime, TweenType.Looping, Disappear);
            this.generatingAlarm = new Alarm(generatingTime, TweenType.Looping, Generate);
            AddTween(this.waitAlarm, true);
            AddTween(this.generatingAlarm, true);

            this.enemyTypes = new List<Type>();
            this.enemyTypes.Add(typeof(VirusEnemy));
            this.enemyTypes.Add(typeof(TroyEnemy));
            this.enemyTypes.Add(typeof(Troy2Enemy));
            this.enemyTypes.Add(typeof(DOSEnemy));
            this.enemyTypes.Add(typeof(DOS2Enemy));
            this.enemyTypes.Add(typeof(WormEnemy));
            this.enemyTypes.Add(typeof(SlowEnemy));

            this.hackintoshFanController = new HackintoshBossFanController(this, 40);
            OGE.CurrentWorld.AddEntity(hackintoshFanController);

            AddCollisionMask(new HitboxMask(110, 110, 55, 55));
        }
예제 #18
0
 public ParticleGenerator(ParticleEffectSystem particleSystem, Particle particlePrototype)
 {
     this.particleSystem = particleSystem;
     this.particlePrototype = particlePrototype;
     this.random = new Random();
 }
예제 #19
0
        public void LoadContent()
        {
            #region Load textures

            Texture2D tempParticle = OGE.Content.Load<Texture2D>(@"Graphics\Particles\BlurParticle");
            particleTextures.Add(ParticleTextureType.BlurredCircle, tempParticle);

            tempParticle = OGE.Content.Load<Texture2D>(@"Graphics\Particles\FireParticle");
            particleTextures.Add(ParticleTextureType.BlurredFire, tempParticle);

            tempParticle = OGE.Content.Load<Texture2D>(@"Graphics\Particles\LineParticle");
            particleTextures.Add(ParticleTextureType.BlurredLine, tempParticle);

            tempParticle = OGE.Content.Load<Texture2D>(@"Graphics\Particles\BlurSquare");
            particleTextures.Add(ParticleTextureType.BlurredSquare, tempParticle);

            #endregion

            #region Load Patterns

            ParticlePattern doubleCircleDoubleLayerPattern = new ParticlePattern(100);
            ParticlePattern doubleLayerCirclePattern = new ParticlePattern(100);
            ParticlePattern circlePattern = new ParticlePattern(100);
            ParticlePattern doubleCirclePattern = new ParticlePattern(100);
            Particle temp;
            Particle cloneTemp;
            float direction;

            for (int i = 0; i < 25; i++)
            {
                direction = random.Next(360);

                temp = new Particle();
                temp.Direction = direction;
                temp.Angle = direction;
                temp.DeltaSpeed = -0.5f;
                temp.DeltaScale = -0.02f;

                doubleCircleDoubleLayerPattern.Particles[2 * i] = temp;
                doubleCircleDoubleLayerPattern.Particles[2 * i + 1] = temp;

                doubleLayerCirclePattern.Particles[2 * i] = temp;
                doubleLayerCirclePattern.Particles[2 * i + 1] = temp;

                direction = random.Next(360);

                cloneTemp = temp.Clone();
                cloneTemp.Direction = direction;
                cloneTemp.Angle = direction;

                circlePattern.Particles[2 * i] = temp;
                circlePattern.Particles[2 * i + 1] = cloneTemp;

                doubleCirclePattern.Particles[2 * i] = temp;
                doubleCirclePattern.Particles[2 * i + 1] = cloneTemp;
            }

            for (int i = 25; i < 50; i++)
            {
                direction = random.Next(360);

                temp = new Particle();
                temp.Position.X = (float)(50 * Math.Cos(MathHelper.ToRadians(direction)));
                temp.Position.Y = (float)(50 * Math.Sin(MathHelper.ToRadians(direction)));
                temp.Direction = direction;
                temp.Angle = direction;
                temp.DeltaSpeed = -0.4f;
                temp.DeltaScale = -0.02f;

                doubleCircleDoubleLayerPattern.Particles[2 * i] = temp;
                doubleCircleDoubleLayerPattern.Particles[2 * i + 1] = temp;

                cloneTemp = temp.Clone();
                cloneTemp.Position.X = 0;
                cloneTemp.Position.Y = 0;

                doubleLayerCirclePattern.Particles[2 * i] = cloneTemp;
                doubleLayerCirclePattern.Particles[2 * i + 1] = cloneTemp;

                circlePattern.Particles[2 * i] = cloneTemp;

                direction = random.Next(360);

                cloneTemp = temp.Clone();
                cloneTemp.Direction = direction;
                cloneTemp.Angle = direction;

                doubleCirclePattern.Particles[2 * i] = temp;
                doubleCirclePattern.Particles[2 * i + 1] = cloneTemp;

                cloneTemp = cloneTemp.Clone();
                cloneTemp.Position.X = 0;
                cloneTemp.Position.Y = 0;

                circlePattern.Particles[2 * i + 1] = cloneTemp;
            }

            patterns.Add(ParticlePatternType.DoubleCircleDoubleLayerCirclePattern, doubleCircleDoubleLayerPattern);
            patterns.Add(ParticlePatternType.DoubleLayerCirclePattern, doubleLayerCirclePattern);
            patterns.Add(ParticlePatternType.CirclePattern, circlePattern);
            patterns.Add(ParticlePatternType.DoubleCirclePattern, doubleCirclePattern);

            #endregion
        }
예제 #20
0
        private void IntializeParticleGenerators()
        {
            Particle particlePrototype = new Particle();
            particlePrototype.ParticleColor = new Color(40, 72, 127);
            particlePrototype.DeltaScale = -0.06f;
            particlePrototype.DeltaAlpha = -0.1f;

            this.trailParticleGenerator = new TrailParticleGenerator(OGE.CurrentWorld.TrailEffectSystem, particlePrototype);
            this.trailParticleGenerator.AngleDisplacement = 15;
            this.trailParticleGenerator.Speed = 2;
            this.trailParticleGenerator.Scale = 0.5f;

            Particle prototype = new Particle();
            prototype.DeltaScale = -0.03f;
            prototype.DeltaSpeed = -0.02f;
            prototype.DeltaAngle = 5f;

            this.fractionalGenerator = new FractionalParticleGenerator(OGE.CurrentWorld.ExplosionEffectSystem, prototype, 6);
            this.fractionalGenerator.Speed = 5;
            this.fractionalGenerator.NumberOfCircles = 3;
        }