Exemple #1
0
 public Fixture(Vector3 position, SpriteSheet asset, Point frame, GameComponent parent)
     : base("Fixture", parent, Matrix.CreateTranslation(position), Vector3.One * 0.45f, Vector3.Zero, true)
 {
     Sprite = new Sprite(Manager, "Sprite", this, Matrix.Identity, asset, false);
     Sprite.AddAnimation(new Animation(asset.GenerateFrame(frame)));
     AddToCollisionManager = false;
     CollisionType = CollisionManager.CollisionType.Static;
 }
Exemple #2
0
        public BearTrap(Vector3 pos)
            : base("BearTrap", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(pos),
            new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, true)
        {
            Allies = PlayState.PlayerFaction;
            Sensor = new Sensor("Sensor", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero)
            {
                FireTimer = new Timer(0.5f, false)
            };
            Sensor.OnSensed += Sensor_OnSensed;
            DeathTimer = new Timer(0.6f, true);
            DeathParticles = new ParticleTrigger("puff", PlayState.ComponentManager, "DeathParticles", this,
                Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero)
            {
                SoundToPlay = ""
            };

            DamageAmount = 200;
            Voxel voxUnder = new Voxel();
            PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(pos, ref voxUnder);
            VoxListener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxUnder);
            Sprite = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.Identity, new SpriteSheet(ContentPaths.Entities.DwarfObjects.beartrap), false);
            Sprite.AddAnimation(new Animation(0, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32,  0) {Name = IdleAnimation});
            Sprite.AddAnimation(new Animation(1, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32,  0, 1, 2, 3) {Name = TriggerAnimation, Speeds =  new List<float>() {6.6f}, Loops = true});
        }
Exemple #3
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);
        }