grab interaction system
This commit is contained in:
parent
3ee827ad1f
commit
f8b13ff533
1 changed files with 64 additions and 2 deletions
66
src/Mono.cs
66
src/Mono.cs
|
@ -9,7 +9,12 @@ static class Mono
|
|||
|
||||
public static int score;
|
||||
|
||||
public static Pose world_pose;
|
||||
// to be wrapped in a dof base class
|
||||
public static Pose dof_pose;
|
||||
public static float dof_scl;
|
||||
// custom inside data/class
|
||||
public static Grab to_grab;
|
||||
public static Grab from_grab;
|
||||
|
||||
public static DeltaBool menu;
|
||||
public static Pose menu_pose;
|
||||
|
@ -26,11 +31,15 @@ static class Mono
|
|||
public static void Init()
|
||||
{
|
||||
game_time = 0.0;
|
||||
world_pose = new(0, -1, -2);
|
||||
menu = new(false);
|
||||
menu_pose = new(0, 0, 0);
|
||||
menu_scale = 1 * U.cm;
|
||||
mode = Mode.Mount;
|
||||
|
||||
dof_pose = new(0, 0, 0); // new(0, -1, -2);
|
||||
dof_scl = 1.0f; // 0.1f;
|
||||
to_grab = new();
|
||||
from_grab = new();
|
||||
}
|
||||
|
||||
public static void Frame()
|
||||
|
@ -90,5 +99,58 @@ static class Mono
|
|||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
Grab[] grabs = new Grab[]
|
||||
{
|
||||
to_grab,
|
||||
from_grab
|
||||
};
|
||||
foreach (var grab in grabs)
|
||||
{
|
||||
if (!grab.Held)
|
||||
{
|
||||
if (Rig.l_held == null)
|
||||
{
|
||||
if (Rig.btn_l_grip.delta == +1)
|
||||
{
|
||||
grab.OnGrab(ref Rig.l_hnd, ref Rig.l_held);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Rig.l_held == grab)
|
||||
{
|
||||
if (Rig.btn_l_grip.delta == -1)
|
||||
{
|
||||
grab.OnRelease();
|
||||
Rig.l_held = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!grab.Held)
|
||||
{
|
||||
if (Rig.r_held == null)
|
||||
{
|
||||
if (Rig.btn_r_grip.delta == +1)
|
||||
{
|
||||
grab.OnGrab(ref Rig.r_hnd, ref Rig.r_held);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Rig.r_held == grab)
|
||||
{
|
||||
if (Rig.btn_r_grip.delta == -1)
|
||||
{
|
||||
grab.OnRelease();
|
||||
Rig.r_held = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grab.Frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue