diff --git a/Scripts/Camera.gd b/Scripts/Camera.gd index 20a35af..1289a7e 100644 --- a/Scripts/Camera.gd +++ b/Scripts/Camera.gd @@ -1,16 +1,30 @@ extends Camera +const TRANSLATION_SPEED : float = 0.1 +const ROTATION_SPEED : float = 0.025 func _physics_process(delta : float) -> void: if Input.is_action_pressed("camera_forward"): - translate(Vector3(0, 0, 1)) + translate(TRANSLATION_SPEED * Vector3(0, 0, -1)) if Input.is_action_pressed("camera_backward"): - translate(Vector3(0, 0, -1)) + translate(TRANSLATION_SPEED * Vector3(0, 0, 1)) if Input.is_action_pressed("camera_strafe_up"): - translate(Vector3(0, 1, 0)) + translate(TRANSLATION_SPEED * Vector3(0, 1, 0)) if Input.is_action_pressed("camera_strafe_down"): - translate(Vector3(0, -1, 0)) + translate(TRANSLATION_SPEED * Vector3(0, -1, 0)) if Input.is_action_pressed("camera_strafe_right"): - translate(Vector3(1, 0, 0)) + translate(TRANSLATION_SPEED * Vector3(1, 0, 0)) if Input.is_action_pressed("camera_strafe_left"): - translate(Vector3(-1, 0, 0)) + translate(TRANSLATION_SPEED * Vector3(-1, 0, 0)) + if Input.is_action_pressed("camera_pitch_down"): + rotate_object_local(Vector3(1,0,0), -ROTATION_SPEED) + if Input.is_action_pressed("camera_pitch_up"): + rotate_object_local(Vector3(1,0,0), ROTATION_SPEED) + if Input.is_action_pressed("camera_roll_left"): + rotate_object_local(Vector3(0,0,1), ROTATION_SPEED) + if Input.is_action_pressed("camera_roll_right"): + rotate_object_local(Vector3(0,0,1), -ROTATION_SPEED) + if Input.is_action_pressed("camera_yaw_left"): + rotate_object_local(Vector3(0,1,0), ROTATION_SPEED) + if Input.is_action_pressed("camera_yaw_right"): + rotate_object_local(Vector3(0,1,0), -ROTATION_SPEED) diff --git a/Scripts/Plan.gd b/Scripts/Plan.gd new file mode 100644 index 0000000..f79b288 --- /dev/null +++ b/Scripts/Plan.gd @@ -0,0 +1,18 @@ +class_name Plan + +const TURN_TIME : float = 5.0 + +var elements = [] # All elements of the plan thus far +var current_elements = [] # All elements of the next 5 seconds + +func sanity_check() -> bool: + # Returns true if sane and false if insane + var total_time : float = 0.0 + for current_element in current_elements: + var element : PlanElement = (current_element as PlanElement) + total_time += elemet.time + if !element.sanity_check(): + return false + if total_time > TURN_TIME: + return false + return true diff --git a/Scripts/PlanElement.gd b/Scripts/PlanElement.gd new file mode 100644 index 0000000..cc87fd5 --- /dev/null +++ b/Scripts/PlanElement.gd @@ -0,0 +1,3 @@ +class_name PlanElement + +var time = 0.0 diff --git a/project.godot b/project.godot index 04170c5..27f3921 100644 --- a/project.godot +++ b/project.godot @@ -8,9 +8,20 @@ config_version=4 -_global_script_classes=[ ] +_global_script_classes=[ { +"base": "Reference", +"class": "Plan", +"language": "GDScript", +"path": "res://Scripts/Plan.gd" +}, { +"base": "Reference", +"class": "PlanElement", +"language": "GDScript", +"path": "res://Scripts/PlanElement.gd" +} ] _global_script_class_icons={ - +"Plan": "", +"PlanElement": "" } [application]