public GroundPoundHitbox(Vector3 position, Character attackingCharacter, float damage, float minFlinch, float maxFlinch, Environment environment)
            : base(new Box(position, WIDTH, HEIGHT, 1, .01f))
        {
            // It's not going to be alive very long anyhow.
            this.bepuPhysicsComponent.Box.IsAffectedByGravity = false;
            this.bepuPhysicsComponent.Box.LinearVelocity = Vector3.Zero;

            HoldOffsetComponent offsetComponent = new HoldOffsetComponent(this, (BepuPhysicsComponent) attackingCharacter.GetComponent("BepuPhysicsComponent"));
            this.AttachComponent(offsetComponent);

            // Create the rendering component. Since the cube model is 1x1x1,
            // it needs to be scaled to match the size of each individual box.
            Matrix scaling = Matrix.CreateScale(WIDTH, HEIGHT, 1);
            BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling);
            this.AttachComponent(drawComponent);

            DamageOnImpactComponent damageComponent = new DamageOnImpactComponent(this, damage, environment, minFlinch, maxFlinch);
            damageComponent.IgnoreEntity(attackingCharacter);
            this.AttachComponent(damageComponent);

            SelfDestructOnImpactComponent selfDestructImpact = new SelfDestructOnImpactComponent(this, environment, true);
            selfDestructImpact.IgnoreEntity(attackingCharacter);
            this.AttachComponent(selfDestructImpact);

            SelfDestructOnJumpComponent selfDestructJump = new SelfDestructOnJumpComponent(this, environment, attackingCharacter);
            this.AttachComponent(selfDestructJump);
        }
Пример #2
0
        public BepuPhysicsBox(Box b, Model m)
        {
            // Create the physics Component.
            bepuPhysicsComponent = new BepuPhysicsComponent(this, b);

            // Create the rendering component. Since the cube model is 1x1x1,
            // it needs to be scaled to match the size of each individual box.
            Matrix scaling = Matrix.CreateScale(b.Width, b.Height, b.Length);
            BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling);

            this.AttachComponent(bepuPhysicsComponent);
            this.AttachComponent(drawComponent);
        }
Пример #3
0
        public Rock(Vector3 spawnPosition, Environment environment)
            : base(new Box(spawnPosition, 1, 1, 1, MASS))
        {
            this.environment = environment;

            // Create the rendering component. Since the cube model is 1x1x1,
            // it needs to be scaled to match the size of each individual box.
            Matrix scaling = Matrix.CreateScale(1, 1, 1);
            BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling);
            this.AttachComponent(drawComponent);

            grabbable = new GrabbableComponent(this, 0, 100);
            grabbable.OnThrow += OnRockThrow;
            this.AttachComponent(grabbable);
        }
Пример #4
0
        public Platform(Vector3 position, float width, float height, float length)
        {
            this.width = width;
            this.height = height;
            this.length = length;

            // Create the physics Component.
            this.bepuPhysicsComponent = new BepuPhysicsComponent(this, new Box(position, width, height, length));

            // Create the rendering component. Since the cube model is 1x1x1,
            // it needs to be scaled to match the size of each individual box.
            Matrix scaling = Matrix.CreateScale(width, height, length);
            BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling);

            this.AttachComponent(bepuPhysicsComponent);
            this.AttachComponent(drawComponent);
        }
Пример #5
0
        public Projectile(Vector3 spawnPosition, Vector3 velocity, Environment environment, Character attackingCharacter, float damage, float minFlinch, float maxFlinch)
            : base(new Box(spawnPosition, .75f, .75f, .75f, 0.01f))
        {
            this.bepuPhysicsComponent.Box.LinearVelocity = velocity;
            this.bepuPhysicsComponent.Box.IsAffectedByGravity = false;

            //List<Entity> projectilesToIgnore = environment.GetEntitiesOfType<Projectile>();

            DamageOnImpactComponent damageComponent = new DamageOnImpactComponent(this, damage, environment, minFlinch, maxFlinch);
            damageComponent.IgnoreEntity(attackingCharacter);
            this.AttachComponent(damageComponent);

            SelfDestructOnImpactComponent selfDestructComponent = new SelfDestructOnImpactComponent(this, environment, true);
            selfDestructComponent.IgnoreEntity(attackingCharacter);
            this.AttachComponent(selfDestructComponent);

            // Create the rendering component. Since the cube model is 1x1x1,
            // it needs to be scaled to match the size of each individual box.
            Matrix scaling = Matrix.CreateScale(.75f, .75f, .75f);
            BasicModelComponent drawComponent = new CubeRenderComponent(this, scaling);
            this.AttachComponent(drawComponent);
        }