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);
        }
Ejemplo n.º 2
0
        public void OnRockThrow(object sender, EventArgs e)
        {
            DamageOnImpactComponent damageComponent = new DamageOnImpactComponent(this, DAMAGE, environment, MIN_FLINCH_DISTANCE, MAX_FLINCH_DISTANCE);
            damageComponent.IgnoreEntity((Character) grabbable.Grabber.Parent);
            this.AttachComponent(damageComponent);

            SelfDestructOnImpactComponent selfDestructComponent = new SelfDestructOnImpactComponent(this, environment, false);
            selfDestructComponent.IgnoreEntity(grabbable.Grabber.Parent);
            this.AttachComponent(selfDestructComponent);
        }
Ejemplo n.º 3
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);
        }