Btn
This commit is contained in:
parent
162d4f8b98
commit
b9e2f061b8
1 changed files with 14 additions and 0 deletions
|
@ -30,4 +30,18 @@ public class Rig {
|
||||||
|
|
||||||
perch_pos = palm_pos + Vec3.Up * 8 * U.cm;
|
perch_pos = palm_pos + Vec3.Up * 8 * U.cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct Btn {
|
||||||
|
public bool frameDown, held, frameUp;
|
||||||
|
|
||||||
|
public void Frame(bool down, bool? up = null) {
|
||||||
|
if (up != null && held) {
|
||||||
|
down = !(bool)up;
|
||||||
|
}
|
||||||
|
|
||||||
|
frameDown = down && !held;
|
||||||
|
frameUp = !down && held;
|
||||||
|
held = down;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue