/** * Toggle character ducking. When ducked the characters capsule collision * shape height will be multiplied by duckedFactor to make the capsule * smaller. When unducking, the character will check with a ray test if it * can in fact unduck and only do so when its possible. You can test the * state using isDucked(). * * @param enabled true→duck, false→unduck */ public void setDucked(boolean enabled) { if (enabled) { setHeightPercent(duckedFactor); ducked = true; wantToUnDuck = false; } else { if (checkCanUnDuck()) { setHeightPercent(1); ducked = false; } else { wantToUnDuck = true; } } }
/** * Toggle character ducking. When ducked the characters capsule collision * shape height will be multiplied by duckedFactor to make the capsule * smaller. When unducking, the character will check with a ray test if it * can in fact unduck and only do so when its possible. You can test the * state using isDucked(). * * @param enabled true→duck, false→unduck */ public void setDucked(boolean enabled) { if (enabled) { setHeightPercent(duckedFactor); ducked = true; wantToUnDuck = false; } else { if (checkCanUnDuck()) { setHeightPercent(1); ducked = false; } else { wantToUnDuck = true; } } }
if (wantToUnDuck && checkCanUnDuck()) { setHeightPercent(1); wantToUnDuck = false;
if (wantToUnDuck && checkCanUnDuck()) { setHeightPercent(1); wantToUnDuck = false;
/** * Toggle character ducking. When ducked the characters capsule collision * shape height will be multiplied by duckedFactor to make the capsule * smaller. When unducking, the character will check with a ray test if it * can in fact unduck and only do so when its possible. You can check the * state of the unducking by checking isDucked(). * * @param enabled */ public void setDucked(boolean enabled) { if (enabled) { setHeightPercent(duckedFactor); ducked = true; wantToUnDuck = false; } else { if (checkCanUnDuck()) { setHeightPercent(1); ducked = false; } else { wantToUnDuck = true; } } }
/** * Toggle character ducking. When ducked the characters capsule collision * shape height will be multiplied by duckedFactor to make the capsule * smaller. When unducking, the character will check with a ray test if it * can in fact unduck and only do so when its possible. You can test the * state using isDucked(). * * @param enabled true→duck, false→unduck */ public void setDucked(boolean enabled) { if (enabled) { setHeightPercent(duckedFactor); ducked = true; wantToUnDuck = false; } else { if (checkCanUnDuck()) { setHeightPercent(1); ducked = false; } else { wantToUnDuck = true; } } }
if (wantToUnDuck && checkCanUnDuck()) { setHeightPercent(1); wantToUnDuck = false;
if (wantToUnDuck && checkCanUnDuck()) { setHeightPercent(1); wantToUnDuck = false;