initial commit
This commit is contained in:
commit
633c8e3ca7
|
@ -0,0 +1,11 @@
|
|||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Play in Editor",
|
||||
"type": "godot-mono",
|
||||
"mode": "playInEditor",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "godot-mono",
|
||||
"request": "launch",
|
||||
"mode": "executable",
|
||||
"preLaunchTask": "build",
|
||||
"executable": "/usr/bin/godot-mono",
|
||||
"executableArguments": [
|
||||
"--path",
|
||||
"${workspaceRoot}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Launch (Select Scene)",
|
||||
"type": "godot-mono",
|
||||
"request": "launch",
|
||||
"mode": "executable",
|
||||
"preLaunchTask": "build",
|
||||
"executable": "/usr/bin/godot-mono",
|
||||
"executableArguments": [
|
||||
"--path",
|
||||
"${workspaceRoot}",
|
||||
"${command:SelectLaunchScene}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Attach",
|
||||
"type": "godot-mono",
|
||||
"request": "attach",
|
||||
"address": "localhost",
|
||||
"port": 23685
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "/usr/bin/godot-mono",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"--build-solutions",
|
||||
"--path",
|
||||
"${workspaceRoot}",
|
||||
"--no-window",
|
||||
"-q"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="Environment" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="ProceduralSky" id=1]
|
||||
|
||||
[resource]
|
||||
background_mode = 2
|
||||
background_sky = SubResource( 1 )
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.png"
|
||||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
|
@ -0,0 +1,5 @@
|
|||
<Project Sdk="Godot.NET.Sdk/3.3.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "learnin", "learnin.csproj", "{99680112-79F2-4DCB-AC6B-3C08793C23FF}"
|
||||
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
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{99680112-79F2-4DCB-AC6B-3C08793C23FF}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,27 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=4
|
||||
|
||||
[application]
|
||||
|
||||
config/name="learnin"
|
||||
run/main_scene="res://scenes/Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[global]
|
||||
|
||||
mono=true
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
|
@ -0,0 +1,18 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/Train.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/Railway.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/OrbitCamera.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
||||
[node name="Train" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 0.515898, 0.606099, -0.605386, -0.393123, 0.795389, 0.461314, 0.76112, -2.26831e-08, 0.648611, 0, 0, 0 )
|
||||
|
||||
[node name="OrbitCamera" parent="." instance=ExtResource( 3 )]
|
||||
_speed = 1.0
|
||||
|
||||
[node name="Railway" parent="." instance=ExtResource( 2 )]
|
||||
script = null
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/OrbitCamera.cs" type="Script" id=1]
|
||||
|
||||
[node name="OrbitCamera" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 0.636065, -0.249781, 0.73009, 0, 0.946159, 0.323703, -0.771636, -0.205896, 0.601818, 8.49012, 5.30069, 6.71091 )
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="CSharpScript" id=1]
|
||||
script/source = "using Godot;
|
||||
using System;
|
||||
|
||||
public class RailNode : Spatial
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// public override void _Process(float delta)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
||||
"
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
script = SubResource( 1 )
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/Railway.cs" type="Script" id=1]
|
||||
|
||||
[sub_resource type="Curve3D" id=1]
|
||||
_data = {
|
||||
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 8.10688, -1.81506, 7.57791, 0, 0, 0, 0, 0, 0, -4.46766, -3.67929, 0.175438, 0, 0, 0, 0, 0, 0, -6.79476, 2.00362, -6.79993, 0, 0, 0, 0, 0, 0, 5.56111, 6.33345, -1.84912, 0, 0, 0, 0, 0, 0, 11.2517, 3.50708, 4.91382, 0, 0, 0, 0, 0, 0, 14.9168, -0.251479, 11.0718 ),
|
||||
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0 )
|
||||
}
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
flags_unshaded = true
|
||||
vertex_color_use_as_albedo = true
|
||||
|
||||
[node name="Railway" type="Path"]
|
||||
curve = SubResource( 1 )
|
||||
script = ExtResource( 1 )
|
||||
_color = Color( 0, 1, 0.133333, 1 )
|
||||
|
||||
[node name="ImmediateGeometry" type="ImmediateGeometry" parent="."]
|
||||
material_override = SubResource( 2 )
|
||||
|
||||
[connection signal="curve_changed" from="." to="." method="OnPathCurveChanged"]
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/Train.cs" type="Script" id=1]
|
||||
|
||||
[node name="Train" type="Node"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CSGBox" type="CSGBox" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0 )
|
||||
width = 1.0
|
||||
height = 1.0
|
||||
depth = 4.0
|
|
@ -0,0 +1,18 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public class OrbitCamera : Spatial
|
||||
{
|
||||
[Export]
|
||||
private float _speed;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
Rotate(Vector3.Up, _speed * delta);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class Railway : Path
|
||||
{
|
||||
[Export]
|
||||
private Color _color;
|
||||
|
||||
[Export]
|
||||
private float _gauge = 1f;
|
||||
|
||||
private ImmediateGeometry _geo = null;
|
||||
private Vector3[] _points = null;
|
||||
|
||||
public void OnPathCurveChanged()
|
||||
{
|
||||
Curve.Tessellate();
|
||||
_points = Curve.GetBakedPoints();
|
||||
}
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_geo = GetNode<ImmediateGeometry>("ImmediateGeometry");
|
||||
|
||||
var m = new SpatialMaterial();
|
||||
m.VertexColorUseAsAlbedo = true;
|
||||
m.FlagsUnshaded = true;
|
||||
_geo.MaterialOverride = m;
|
||||
|
||||
OnPathCurveChanged();
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
base._Process(delta);
|
||||
|
||||
if (_geo == null) return;
|
||||
if (_points == null || _points.Length == 0) return;
|
||||
|
||||
_geo.Clear();
|
||||
_geo.Begin(Mesh.PrimitiveType.LineStrip);
|
||||
_geo.SetColor(new Color(1, 0, 0));
|
||||
for(int i = 0; i < _points.Length; i++)
|
||||
{
|
||||
_geo.AddVertex(_points[i]);
|
||||
}
|
||||
_geo.End();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class Tracks : ImmediateGeometry
|
||||
{
|
||||
private SpatialMaterial _m;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// set up a material for imgui to use
|
||||
_m = new SpatialMaterial();
|
||||
_m.VertexColorUseAsAlbedo = true;
|
||||
_m.FlagsUnshaded = true;
|
||||
this.MaterialOverride = _m;
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
GD.Print("hi!");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public class Train : Node
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
// // Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
// public override void _Process(float delta)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue