public void Step(ref HealthPickupInfo token, Enum condition) { if ((DamageCondition)condition == DamageCondition.heal) { OnHealEvent(ref token); } }
//adding method to heal void Heal <T> (ref T heal) where T : IHealInfo { var node = nodesDB.QueryNode <HealthNode>(heal.entityHealed); var healthComponent = node.healthComponent; int health = healthComponent.currentHealth + heal.HPGained; healthComponent.currentHealth = Math.Min(health, healthComponent.maxHealth); //using -1 for pickupID as I can't retrieve the pickupID here and we don't actuallneed the value HealthPickupInfo info = new HealthPickupInfo(heal.entityHealed, -1, heal.HPGained); _healSequence.Next(this, ref info, DamageCondition.heal); }
//Healing event //similar to damage event but increases value of the slider, and doesn't flash the damage image void OnHealEvent(ref HealthPickupInfo token) { _guiNode.healthSliderComponent.healthSlider.value = nodesDB.QueryNode <HUDDamageEventNode>(token.entity).healthComponent.currentHealth; }