101 lines
3 KiB
C#
101 lines
3 KiB
C#
using System.Collections.Generic;
|
|
using StereoKit;
|
|
|
|
namespace slash;
|
|
|
|
static class Mono
|
|
{
|
|
public static double game_time;
|
|
|
|
public static int score;
|
|
|
|
public static Pose world_pose;
|
|
|
|
public static DeltaBool menu;
|
|
public static Pose menu_pose;
|
|
public static float menu_scale;
|
|
|
|
public enum Mode
|
|
{
|
|
Float = -1,
|
|
Hold = 0,
|
|
Mount = 1,
|
|
}
|
|
public static Mode mode;
|
|
|
|
public static Enemy[] enemy_types;
|
|
|
|
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;
|
|
|
|
enemy_types = new Enemy[] {
|
|
new("d"), new("s"), new("h"),
|
|
new("ds"), new("sh"), new("hd"),
|
|
};
|
|
}
|
|
|
|
public static void Frame()
|
|
{
|
|
if (Rig.btn_back.delta == +1)
|
|
{
|
|
menu.Step(!menu.state);
|
|
SFX.click.PlayMenu();
|
|
}
|
|
|
|
if (menu.state)
|
|
{
|
|
// just one btn(resume) in menu rn
|
|
if (Rig.btn_select.delta == +1)
|
|
{
|
|
Rig.btn_select.delta = 0; // [!] hacky capture
|
|
menu.Step(false);
|
|
SFX.click.PlayMenu();
|
|
}
|
|
}
|
|
|
|
// flatscreen dev controls
|
|
if (Device.Name == "Simulator")
|
|
{
|
|
if (Input.Key(Key.MouseCenter).IsActive())
|
|
{
|
|
float sx = Input.Mouse.posChange.x;
|
|
Renderer.CameraRoot *= Matrix.R(
|
|
Quat.FromAngles(0, -sx * 180.0f * Time.Stepf, 0)
|
|
);
|
|
// orbital_view
|
|
// box_pose.position = Input.Head.position + Input.Head.orientation * V.XYZ(0, -0 * U.cm, -10 * U.cm);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// in_dist.Step(Vec3.Distance(Rig.r_con_stick.position, box_pose.position) < 6 * U.cm);
|
|
// bool pickup = in_dist.state && Rig.btn_grip.delta == +1;
|
|
// in_cone.Step(Vec3.AngleBetween(
|
|
// Rig.head.orientation * Vec3.Forward,
|
|
// Vec3.Direction(box_pose.position, Rig.head.position)
|
|
// ) < 15.0f);
|
|
// switch (mode)
|
|
// {
|
|
// case Mode.Float:
|
|
// if (pickup) { mode = Mode.Hold; }
|
|
// break;
|
|
// case Mode.Hold:
|
|
// box_pose.position = Rig.r_con_stick.position;
|
|
// box_dist = Vec3.Distance(box_pose.position, Rig.head.position);
|
|
// if (Rig.btn_grip.delta == -1) { mode = in_cone.state ? Mode.Mount : Mode.Float; }
|
|
// break;
|
|
// case Mode.Mount:
|
|
// // orbital_view
|
|
// box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -box_dist);
|
|
// if (pickup) { mode = Mode.Hold; }
|
|
// break;
|
|
// }
|
|
}
|
|
}
|
|
}
|