|
Post by controlim2 on Feb 10, 2018 19:33:34 GMT
Hello, I'm a newbie and I'm not good at English either. Sorry for asking a lot of questions.
This part I try to modify a stamina value without touch directly to the Invector code and the result is not good.
As you can see in the video, I try to access the slider value but it doesn't work because it been controlled by another Invector code (even drag the mouse manually, or type in the runtime). I try not to touch the code directly to avoid the future problem. Now, please give me a suggestion to access this value by not touching directly to the Invector code. I think maybe the developer already give the way out but I'm stupid enough to not see it.
|
|
|
Post by resdin on Feb 10, 2018 21:33:40 GMT
This works without modifying any Invector code. This has issues if its called in the update function so requires other code to keep it from draining all the characters stamina within a few frames. This may or may not help and I'm not the greatest programmer; I hack things together that suit my needs. I'm always open for better options if anyone would like to share or better answer his question.
//Drain Stamina
void drainStamina(){
var stam = player.GetComponent<vThirdPersonController> ();
stam.currentStamina -= stamDrainAmount;
if (stam.currentStamina <=0f){
stam.currentStamina = 0f;
}
return;
}//End Drain Stamina
|
|