Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var game = new ShellGame(600, 600);

            Game.LogShouldPrintTime  = true;
            Game.LogShouldPrintLevel = false;

            Particle.Emitter mouseEmitter = null;
            //Particle.Emitter regionEmitter = null;

            game.StartHandler += () =>
            {
                mouseEmitter = new Particle.Emitter(0, 0, new TestRectangleParticleSystem(), new RectangleRegion(new Rectangle(-10, -10, 20, 20)));
                mouseEmitter.AddToGroup();

                //regionEmitter = new Particle.Emitter(0, -300, new TestCircleParticleSystem(), new RectangleRegion(new Rectangle(-300, -320, 600, 10)));
                //regionEmitter.AddToGroup();
            };

            game.UpdateHandler += () =>
            {
                //mouseEmitter.X = Input.Mouse.X;
                //mouseEmitter.Y = Input.Mouse.Y;
                //if(Input.LeftMouseDown)
                mouseEmitter.Emit(50);

                //regionEmitter.Emit(15);
            };

            game.RenderHandler += () =>
            {
            };

            game.Run();
        }
Exemplo n.º 2
0
 public Projectile(Projectile other)
     : base(other)
 {
     v2Velocity = other.v2Velocity;
     rCollisionBox = other.rCollisionBox;
     peEmitter = new Particle.Emitter(other.peEmitter);
     peEmitter.Play();
     peEmitterExplode = new Particle.Emitter(other.peEmitterExplode);
     peEmitterExplode.Stop();
     fDamage = other.fDamage;
     iTimer = other.iTimer;
 }
Exemplo n.º 3
0
 public Projectile(ContentManager Content, Vector2 v2_Velocity,int i_Timer, string s_Tex)
     : base(Content, s_Tex)
 {
     rCollisionBox = new Rectangle((int)Position.X, (int)Position.Y, FrameWidth, FrameHeight);
     v2Velocity = v2_Velocity;
     peEmitterExplode = Particle.Emitter.Explode(Content, v2_Velocity, s_Tex);
     peEmitterExplode.Stop();
     peEmitterExplode.Colour = Color.Tan;
     peEmitter = Particle.Emitter.Projectile(Content, v2_Velocity, s_Tex);
     peEmitter.Reset();
     Origin = new Vector2(16, 16);
     fDamage = 5;
     iTimer = i_Timer;
 }
Exemplo n.º 4
0
        public Entity(ContentManager Content, String t2d_Tex = "image")
            : base(Content, t2d_Tex)
        {
            fHealthCurrent = fHealthMax = 5.0f;
            fSpeed = 0.5f;

            rCollisionBox = new Rectangle(0, 0, FrameWidth, FrameHeight);
            seHit = Content.Load<SoundEffect>("Entities/Sound/hit02");
            v2Velocity = new Vector2(0, 0);

            asHealth = new AnimatedSprite(Content, "pixel");
            bDrawHealth = false;

            peEmitter = Particle.Emitter.Burst(Content);
            peEmitter.Stop();
        }
Exemplo n.º 5
0
        public Entity(Entity other)
            : base(other)
        {
            bDrawHealth = other.bDrawHealth;

            fHealthCurrent = fHealthMax = other.fHealthCurrent = other.fHealthMax;
            fSpeed = other.fSpeed;

            rCollisionBox = other.rCollisionBox;
            seHit = other.seHit;
            v2Velocity = other.v2Velocity;
            peEmitter = new Particle.Emitter(other.peEmitter);
            peEmitter.Stop();

            asHealth = other.asHealth;
        }
Exemplo n.º 6
0
        public Player(Player other)
            : base(other)
        {
            fReboundDuration = other.fReboundDuration;
            bDrawHealth = other.bDrawHealth;

            wWeapon = other.wWeapon;
            //lPsycheQueue = new List<Items.Psyche>();

            v2FacingDir = other.v2FacingDir;

            //  ParticleEmitters
            fShieldDuration = other.fShieldDuration;
            peShield = new Particle.Emitter(other.peShield);

            fHealAmount = other.fHealAmount;
            fHealDuration = other.fHealDuration;
            peHeal = new Particle.Emitter(other.peHeal);

            fInvisibleAmount = other.fInvisibleAmount;
            fInvisibleDuration = other.fInvisibleDuration;
            peInvisible = new Particle.Emitter(other.peInvisible);

            //  AttackSwing
            fAttackTimer = other.fAttackTimer;
            asAttackSprite = new AnimatedSprite(other.asAttackSprite);
            asAttackSprite.Scale = other.asAttackSprite.Scale;
            asAttackSprite.Origin = other.asAttackSprite.Origin;

            //HUD
            asLeft = new AnimatedSprite(other.asLeft);
            asRight = new AnimatedSprite(other.asRight);

            //  Sound
            seAttackSwing = other.seAttackSwing;
        }
Exemplo n.º 7
0
        public Player(ContentManager Content, String t2d_Tex = "Entities/Player")
            : base(Content, t2d_Tex)
        {
            fReboundDuration = 200;     //rebound duration after attacking in ms
            bDrawHealth = true;
            bAttacking = false;

            HealthCurrent = HealthMax = 20.0f;
            Speed = 2.0f;

            UFrameMax = 9;
            VFrameMax = 1;
            FrameWidth = Texture.Width / UFrameMax;
            FrameHeight = Texture.Height / VFrameMax;
            base.UpdateIndex();

            wWeapon = Items.Weapon.FistBasic(Content);
            //lPsycheQueue = new List<Items.Psyche>();

            Origin = new Vector2(FrameWidth / 2, FrameHeight / 2);

            Position = new Vector2(200, 200);
            v2FacingDir = new Vector2(1, 0);

            psCurrentOrb = null;// Items.Psyche.Type.HATE;

            //  Spells
            //  Dispare
            bShield = false;
            fShieldDuration = 5.0f;
            peShield = Particle.Emitter.Shield(Content, fShieldDuration);
            //  Hate
            bHeal = false;
            fHealDuration = 1.5f;
            fHealAmount = 5.0f;
            peHeal = Particle.Emitter.Heal(Content, fHealDuration);
            //  Misery
            bInvisible = false;
            fInvisibleDuration = 2.0f;
            fInvisibleAmount = 0.2f;
            peInvisible = Particle.Emitter.Invisible(Content);

            //  Attacking
            fAttackTimer = wWeapon.Cooldown;
            asAttackSprite = new AnimatedSprite(Content, "Entities/AttackSwing");
            asAttackSprite.Scale = 0.2f;
            asAttackSprite.Origin = new Vector2(asAttackSprite.FrameWidth / 2, asAttackSprite.FrameHeight / 2);

            seAttackSwing = Content.Load<SoundEffect>("Entities/Sound/swing04");

            //HUD
            asLeft = new AnimatedSprite(Content, "pixel");
            asLeft.Colour = new Color(Color.Black, 1.0f);
            asLeft.FrameHeight = 32;
            asLeft.FrameWidth = 32;
            asLeft.Alpha = 0.2f;

            asRight = new AnimatedSprite(asLeft);

        }
Exemplo n.º 8
0
 public new void xmlImport(XmlReader xml_Reader, ContentManager Content)
 {
     asHealth = new AnimatedSprite(Content, "pixel");
     peEmitter = Particle.Emitter.Burst(Content);
     peEmitter.Stop();
     seHit = Content.Load<SoundEffect>("Entities/Sound/hit02");
     while (xml_Reader.Read())
     {
         String attrib;
         //Console.WriteLine("Entity : " + xml_Reader.Name);
         switch (xml_Reader.Name)
         {
             case "Variables":
                 attrib = xml_Reader["DrawHealth"];
                 if (attrib != null) { bDrawHealth = bool.Parse(attrib); }
                 attrib = xml_Reader["HealthMax"];
                 if (attrib != null) { fHealthCurrent = fHealthMax = float.Parse(attrib); }
                 attrib = xml_Reader["Speed"];
                 if (attrib != null) { fSpeed = float.Parse(attrib); }
                 break;
             case "CollisionBox":
                 attrib = xml_Reader["X"];
                 if (attrib != null) { rCollisionBox.X = int.Parse(attrib); }
                 attrib = xml_Reader["Y"];
                 if (attrib != null) { rCollisionBox.Y = int.Parse(attrib); }
                 attrib = xml_Reader["W"];
                 if (attrib != null) { rCollisionBox.Width = int.Parse(attrib); }
                 attrib = xml_Reader["H"];
                 if (attrib != null) { rCollisionBox.Height = int.Parse(attrib); }
                 break;
             case "Velocity":
                 String attribX = xml_Reader["X"];
                 String attribY = xml_Reader["Y"];
                 if (attribX != null && attribY != null) { v2Velocity = new Vector2(float.Parse(attribX), float.Parse(attribY)); }
                 break;
             case "AnimatedSprite":
                 base.xmlImport(xml_Reader, Content);
                 break;
             case "Entity":
                 return;
         }
     }
 }