Exemplo n.º 1
0
        public Projectile(Vector3 position, Vector3 initialVelocity, Health.DamageAmount damage, float size, string asset, string hitParticles, string hitNoise, Body target) :
            base("Projectile", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(size, size, size), Vector3.One, 1.0f, 1.0f, 1.0f, 1.0f, new Vector3(0, -10, 0))
        {
            Target                = target;
            HitAnimation          = null;
            IsSleeping            = false;
            Velocity              = initialVelocity;
            Orientation           = OrientMode.LookAt;
            AddToCollisionManager = false;
            CollideMode           = Physics.CollisionMode.None;
            Sprite                = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.CreateRotationY((float)Math.PI * 0.5f),
                                               new SpriteSheet(asset), false)
            {
                OrientationType = Sprite.OrientMode.Fixed
            };
            Sprite.SetSingleFrameAnimation(new Point(0, 0));
            Sprite2 = new Sprite(PlayState.ComponentManager, "Sprite2", Sprite, Matrix.CreateRotationX((float)Math.PI * 0.5f),
                                 new SpriteSheet(asset), false)
            {
                OrientationType = Sprite.OrientMode.Fixed
            };
            Sprite2.SetSingleFrameAnimation(new Point(0, 0));

            Damage       = damage;
            HitParticles = new ParticleTrigger(hitParticles, PlayState.ComponentManager, "Hit Particles", this,
                                               Matrix.Identity, new Vector3(size * 0.5f, size * 0.5f, size * 0.5f), Vector3.Zero)
            {
                TriggerOnDeath  = true,
                SoundToPlay     = hitNoise,
                BoxTriggerTimes = 2
            };
            DamageRadius = (float)Math.Pow(size * 4, 2);
        }
Exemplo n.º 2
0
        public Projectile(Vector3 position, Vector3 initialVelocity, Health.DamageAmount damage, float size, string asset, string hitParticles, string hitNoise, string faction)
            : base("Projectile", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(size, size, size), Vector3.One, 1.0f, 1.0f, 1.0f, 1.0f, new Vector3(0, -10, 0))
        {
            Faction = PlayState.ComponentManager.Factions.Factions[faction];
            HitAnimation = null;
            IsSleeping = false;
            Velocity = initialVelocity;
            Orientation = OrientMode.LookAt;
            AddToCollisionManager = false;

            Sprite = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.CreateRotationY((float)Math.PI * 0.5f),
                new SpriteSheet(asset), false)
            {
                OrientationType = Sprite.OrientMode.Fixed
            };
            Sprite.SetSingleFrameAnimation(new Point(0, 0));
            Sprite sprite2 = new Sprite(PlayState.ComponentManager, "Sprite2", Sprite, Matrix.CreateRotationX((float)Math.PI * 0.5f),
                new SpriteSheet(asset), false)
            {
                OrientationType = Sprite.OrientMode.Fixed
            };
            sprite2.SetSingleFrameAnimation(new Point(0, 0));

            Damage = damage;
            HitParticles = new ParticleTrigger(hitParticles, PlayState.ComponentManager, "Hit Particles", this,
                Matrix.Identity, new Vector3(size * 0.5f, size * 0.5f, size * 0.5f), Vector3.Zero)
            {
                TriggerOnDeath = true,
                SoundToPlay = hitNoise,
                BoxTriggerTimes = 2
            };
            DamageRadius = (float)Math.Pow(size*4, 2);
        }
Exemplo n.º 3
0
        public Projectile(ComponentManager manager, Vector3 position, Vector3 initialVelocity, Health.DamageAmount damage, float size, string asset, string hitParticles, string hitNoise, Body target, bool animated = false, bool singleSprite = false) :
            base("Projectile", manager.RootComponent, Matrix.CreateTranslation(position), new Vector3(size, size, size), Vector3.One, 1.0f, 1.0f, 1.0f, 1.0f, new Vector3(0, -10, 0))
        {
            Target                = target;
            HitAnimation          = null;
            IsSleeping            = false;
            Velocity              = initialVelocity;
            Orientation           = OrientMode.LookAt;
            AddToCollisionManager = false;
            CollideMode           = Physics.CollisionMode.None;
            var spriteSheet = new SpriteSheet(asset);

            if (animated)
            {
                spriteSheet.FrameWidth  = Math.Min(spriteSheet.FrameWidth, spriteSheet.FrameHeight);
                spriteSheet.FrameHeight = spriteSheet.FrameWidth;
            }

            Sprite = new Sprite(manager, "Sprite", this, Matrix.CreateRotationY((float)Math.PI * 0.5f),
                                spriteSheet, false)
            {
                OrientationType = Sprite.OrientMode.Fixed
            };
            if (animated)
            {
                Sprite.SetSimpleAnimation();
                Sprite.CurrentAnimation.Play();
            }
            else
            {
                Sprite.SetSingleFrameAnimation();
            }

            if (singleSprite)
            {
                this.Sprite.OrientationType = Sprite.OrientMode.Spherical;
            }

            if (!singleSprite)
            {
                Sprite2 = new Sprite(manager, "Sprite2", Sprite,
                                     Matrix.CreateRotationX((float)Math.PI * 0.5f),
                                     spriteSheet, false)
                {
                    OrientationType = Sprite.OrientMode.Fixed
                };

                if (animated)
                {
                    Sprite2.SetSimpleAnimation();
                }
                else
                {
                    Sprite2.SetSingleFrameAnimation();
                }
            }
            Damage       = damage;
            HitParticles = new ParticleTrigger(hitParticles, manager, "Hit Particles", this,
                                               Matrix.Identity, new Vector3(size * 0.5f, size * 0.5f, size * 0.5f), Vector3.Zero)
            {
                TriggerOnDeath  = true,
                SoundToPlay     = hitNoise,
                BoxTriggerTimes = 2
            };
            DamageRadius = (float)Math.Pow(size * 4, 2);
        }