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);
        }
 public SelfDestructOnJumpComponent(Entity parent, Environment environment, Character attackingCharacter)
     : base(parent, "SelfDestructOnJumpComponent")
 {
     this.markedForRemoval = false;
     this.environment = environment;
     this.jumpComponent = (JumpComponent) attackingCharacter.GetComponent("JumpComponent");
 }
示例#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);
        }
 /// <summary>
 /// Temporarily ignores a character for collision. Entity is ignored 
 /// until the item is no longer colliding with the given entity.
 /// Useful for making exceptions to collision rules.
 /// </summary>
 /// <param name="entity">The entity to ignore.</param>
 public void IgnoreEntityTemporarily(Character entity)
 {
     tempIgnoredEntities.Add(entity);
     ignoredEntities.Add(entity);
 }
 /// <summary>
 /// Permanently ignores an entity for damage. Useful for making 
 /// exceptions to damage rules.
 /// </summary>
 /// <param name="entity">The entity to ignore.</param>
 public void IgnoreEntity(Character entity)
 {
     ignoredEntities.Add(entity);
 }