This commit is contained in:
parent
b29980553a
commit
de59b2486a
13 changed files with 316 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -15,3 +15,5 @@ mono_crash.*.json
|
|||
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
.idea
|
8
Carotrauma.csproj
Normal file
8
Carotrauma.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Godot.NET.Sdk/4.2.2">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
</Project>
|
19
Carotrauma.sln
Normal file
19
Carotrauma.sln
Normal file
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carotrauma", "Carotrauma.csproj", "{BDD108D8-E663-4B77-9DCD-ED487C27EC83}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
ExportDebug|Any CPU = ExportDebug|Any CPU
|
||||
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{BDD108D8-E663-4B77-9DCD-ED487C27EC83}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -60,6 +60,9 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
|
|||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=false
|
||||
dotnet/embed_build_outputs=false
|
||||
|
||||
[preset.1]
|
||||
|
||||
|
@ -100,3 +103,6 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
|||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=false
|
||||
dotnet/embed_build_outputs=false
|
||||
|
|
9
new_shader.tres
Normal file
9
new_shader.tres
Normal file
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="VisualShader" format=3 uid="uid://dxnq2lqe4hnpc"]
|
||||
|
||||
[resource]
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
|
||||
|
||||
|
||||
|
||||
"
|
|
@ -11,10 +11,43 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Carotrauma"
|
||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||
run/main_scene="res://scenes/sandbox/sandbox_scene.tscn"
|
||||
config/features=PackedStringArray("4.2", "C#", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="Carotrauma"
|
||||
|
||||
[editor]
|
||||
|
||||
version_control/plugin_name="GitPlugin"
|
||||
version_control/autoload_on_startup=true
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_forward={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
move_back={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
70
scenes/sandbox/player/SandboxPlayer.cs
Normal file
70
scenes/sandbox/player/SandboxPlayer.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class SandboxPlayer : CharacterBody3D
|
||||
{
|
||||
|
||||
[Export]
|
||||
public float Speed = 5.0f;
|
||||
[Export]
|
||||
public float JumpVelocity = 4.5f;
|
||||
|
||||
// Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
public float gravity = ProjectSettings.GetSetting("physics/3d/default_gravity").AsSingle();
|
||||
|
||||
private float camera_anglev = 0;
|
||||
private Camera3D cam;
|
||||
|
||||
public override void _Ready() {
|
||||
cam = GetChild<Camera3D>(3, true);
|
||||
}
|
||||
|
||||
|
||||
public static float ToRadians (float degrees) {
|
||||
// Angle in 10th of a degree
|
||||
return (float)((degrees * Math.PI)/180.0f);
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event) {
|
||||
if (@event is InputEventMouseMotion) {
|
||||
var M = (InputEventMouseMotion)@event;
|
||||
cam.RotateY(ToRadians(-M.Relative.X * 0.3f));
|
||||
var changeV = -M.Relative.Y * 0.3f;
|
||||
if (camera_anglev + changeV > -50 && camera_anglev + changeV < 50) {
|
||||
camera_anglev += changeV;
|
||||
cam.RotateX(ToRadians(changeV));
|
||||
}
|
||||
GetViewport().SetInputAsHandled();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta) {
|
||||
Vector3 velocity = Velocity;
|
||||
|
||||
// Add the gravity.
|
||||
if (!IsOnFloor())
|
||||
velocity.Y -= gravity * (float)delta;
|
||||
|
||||
// Handle Jump.
|
||||
if (Input.IsActionJustPressed("jump") && IsOnFloor())
|
||||
velocity.Y = JumpVelocity;
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
// As good practice, you should replace UI actions with custom gameplay actions.
|
||||
Vector2 inputDir = Input.GetVector("move_left", "move_right", "move_forward", "move_back");;
|
||||
Vector3 direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
velocity.X = direction.X * Speed;
|
||||
velocity.Z = direction.Z * Speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = Mathf.MoveToward(Velocity.X, 0, Speed);
|
||||
velocity.Z = Mathf.MoveToward(Velocity.Z, 0, Speed);
|
||||
}
|
||||
|
||||
Velocity = velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
23
scenes/sandbox/player/player_scene.tscn
Normal file
23
scenes/sandbox/player/player_scene.tscn
Normal file
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://v5iatrrwgror"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/sandbox/player/SandboxPlayer.cs" id="1_auraj"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_orax3"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_4fhb2"]
|
||||
|
||||
[node name="Player" type="CharacterBody3D"]
|
||||
script = ExtResource("1_auraj")
|
||||
|
||||
[node name="CSGMesh3D" type="CSGMesh3D" parent="."]
|
||||
mesh = SubResource("CapsuleMesh_orax3")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_4fhb2")
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.436351, 0.458557, 0)
|
||||
size = Vector3(0.5, 0.25, 0.25)
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.944686, 0.327976, 0, -0.327976, 0.944686, 0, 1.61751, 2.35265)
|
40
scenes/sandbox/sandbox_scene.tscn
Normal file
40
scenes/sandbox/sandbox_scene.tscn
Normal file
|
@ -0,0 +1,40 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c3hv3mdy52mar"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://v5iatrrwgror" path="res://scenes/sandbox/player/player_scene.tscn" id="1_6lr48"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_tcgka"]
|
||||
size = Vector3(60, 2, 60)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_u6qt5"]
|
||||
size = Vector3(60, 2, 60)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_31ll2"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_gsyqq"]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
|
||||
[node name="Ground" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
|
||||
shape = SubResource("BoxShape3D_tcgka")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
|
||||
mesh = SubResource("BoxMesh_u6qt5")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.77844, -0.360888, 0.513606, 0, 0.81821, 0.57492, -0.627719, -0.447541, 0.636928, 7.0759, 14.6786, 9.0239)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Ball" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.95648, 10.636, 6.23691)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ball"]
|
||||
shape = SubResource("SphereShape3D_31ll2")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ball"]
|
||||
mesh = SubResource("SphereMesh_gsyqq")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_6lr48")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.04543, 0)
|
15
scenes/title/QuitButton.cs
Normal file
15
scenes/title/QuitButton.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class QuitButton : Button
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready() {
|
||||
Text = "Quit";
|
||||
Pressed += OnPressed;
|
||||
}
|
||||
|
||||
private void OnPressed() {
|
||||
GetTree().Quit();
|
||||
}
|
||||
}
|
9
scenes/title/title_scene.tscn
Normal file
9
scenes/title/title_scene.tscn
Normal file
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bgi564yk5w1ik"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://6fwfumgwq52t" path="res://scenes/title/title_ui.tscn" id="1_nbtb5"]
|
||||
|
||||
[node name="TitleScene" type="Node2D"]
|
||||
|
||||
[node name="TitleUi" parent="." instance=ExtResource("1_nbtb5")]
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
65
scenes/title/title_ui.tscn
Normal file
65
scenes/title/title_ui.tscn
Normal file
|
@ -0,0 +1,65 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://6fwfumgwq52t"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://5q8mhw7g6vh6" path="res://icon.svg" id="1_pcdb4"]
|
||||
[ext_resource type="Script" path="res://scenes/title/QuitButton.cs" id="2_51i4u"]
|
||||
|
||||
[node name="TitleUi" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 100.0
|
||||
offset_top = 100.0
|
||||
offset_right = -100.0
|
||||
offset_bottom = -100.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
size_flags_stretch_ratio = 0.0
|
||||
texture = ExtResource("1_pcdb4")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
|
||||
[node name="PlayButton" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "New Game"
|
||||
|
||||
[node name="OptionsButton" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Options"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/VBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("2_51i4u")
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="MarginContainer/HBoxContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
size_flags_stretch_ratio = 0.0
|
||||
texture = ExtResource("1_pcdb4")
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
16
scripts/QuitScript.gd
Normal file
16
scripts/QuitScript.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Node
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _notification(what):
|
||||
print("NOTIFICATION: " + what)
|
||||
if what == NOTIFICATION_WM_CLOSE_REQUEST:
|
||||
get_tree().quit()
|
Loading…
Reference in a new issue