Post by hairgrow on Jul 17, 2024 19:22:14 GMT
So I'm working with the Killable component and trying to get the Calculation Deal Damage Mode to work properly. If I have it set to Attack Points everything works fine. But now I want to dynamically adjust the Damage being dealt so its not the same value each time. I'm creating a VR game where the players has the ability to throw fireballs. To throw the fireball, the player must throw a real punch. At the end of the punch, they squeeze the grip button to launch the fireball. The speed of the punch determines how fast the fireball travels.
I have a simple NPC with a Killable component as well as the fireball itself. Both objects have a rigidbody and collider. All the physics/collision stuff works correctly. If the Deal Damage Mode on the fireball is set to Attack Points, everything works fine. However if I change it to Calculation, and use any one of the Calculation Modes, the damage being dealt is 0. Even if I set the Fixed Damage amount to 100. The damage being dealt comes back as 0. After debugging the Killable class I can see where the dealDamageFixed.Value is always coming in at 0.1. Even after I commented out the 0.1 in
As a test, I changed line 1038 and 1044 to:
and
The NPCs Attack Points is set to 10. After making the above change, I can see the Damage being dealt, but it's 10 everytime.
What am I missing? Essentially I want to alter the Damage being dealt based on the speed of the punch. Or the Velocity that the fireball is traveling. So I assumed using Calculation Mode with FixedTimesVelocityTimesMass would work. Do I have to create a subclass of Killable and then do the calculations myself?
Any help would be greatly appreciated.
I have a simple NPC with a Killable component as well as the fireball itself. Both objects have a rigidbody and collider. All the physics/collision stuff works correctly. If the Deal Damage Mode on the fireball is set to Attack Points, everything works fine. However if I change it to Calculation, and use any one of the Calculation Modes, the damage being dealt is 0. Even if I set the Fixed Damage amount to 100. The damage being dealt comes back as 0. After debugging the Killable class I can see where the dealDamageFixed.Value is always coming in at 0.1. Even after I commented out the 0.1 in
public KillerFloat dealDamageFixed = new KillerFloat(0.1f, .1f, float.MaxValue);
As a test, I changed line 1038 and 1044 to:
attackPoints = (int)(enemy.atckPoints.Value * WorkingMass);
and
attackPoints = (int)(enemy.atckPoints.Value * WorkingMass * WorkingVelocity);
The NPCs Attack Points is set to 10. After making the above change, I can see the Damage being dealt, but it's 10 everytime.
What am I missing? Essentially I want to alter the Damage being dealt based on the speed of the punch. Or the Velocity that the fireball is traveling. So I assumed using Calculation Mode with FixedTimesVelocityTimesMass would work. Do I have to create a subclass of Killable and then do the calculations myself?
Any help would be greatly appreciated.