Floor 0 stuff
This commit is contained in:
@@ -1,41 +1,22 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://by67pn7fdsg1m"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://by67pn7fdsg1m"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/map/Map.cs" id="1_bw70o"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvnc26rebk6o0" path="res://src/map/overworld/Overworld.tscn" id="1_ope1x"]
|
||||
[ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/overworld/Floor0.tscn" id="2_0m8h8"]
|
||||
[ext_resource type="PackedScene" uid="uid://bc1sp6xwe0j65" path="res://src/map/dungeon/floors/Floor01.tscn" id="2_merfv"]
|
||||
[ext_resource type="Script" path="res://src/map/dungeon/code/Floor0.cs" id="3_n0f1p"]
|
||||
[ext_resource type="PackedScene" uid="uid://g28xmp6cn16h" path="res://src/map/dungeon/floors/Floor11.tscn" id="3_niasb"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmiqwmivkjgmq" path="res://src/map/dungeon/floors/Floor02.tscn" id="4_8y0oy"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjqgl5u05ia04" path="res://src/map/dungeon/Teleport.tscn" id="5_jiohg"]
|
||||
[ext_resource type="PackedScene" uid="uid://dl1scvkp8r5sw" path="res://src/map/dungeon/floors/Floor03.tscn" id="5_uag72"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_phn4t"]
|
||||
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
sky_energy_multiplier = 0.3
|
||||
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
|
||||
|
||||
[sub_resource type="Sky" id="Sky_v6mio"]
|
||||
sky_material = SubResource("ProceduralSkyMaterial_phn4t")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_hjjsv"]
|
||||
background_energy_multiplier = 0.0
|
||||
sky = SubResource("Sky_v6mio")
|
||||
ambient_light_source = 1
|
||||
reflected_light_source = 1
|
||||
fog_mode = 1
|
||||
fog_density = 1.0
|
||||
volumetric_fog_enabled = true
|
||||
volumetric_fog_density = 0.0315
|
||||
volumetric_fog_length = 9.49
|
||||
adjustment_enabled = true
|
||||
|
||||
[node name="Map" type="Node3D"]
|
||||
script = ExtResource("1_bw70o")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_hjjsv")
|
||||
|
||||
[node name="Overworld" parent="." instance=ExtResource("1_ope1x")]
|
||||
unique_name_in_owner = true
|
||||
[node name="Floor0" parent="." instance=ExtResource("2_0m8h8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.77792, 1.78656, -5.13176)
|
||||
script = ExtResource("3_n0f1p")
|
||||
|
||||
[node name="Floor11" parent="." instance=ExtResource("3_niasb")]
|
||||
|
||||
|
||||
@@ -30,10 +30,20 @@ namespace GameJamDungeon
|
||||
|
||||
[Node] public Area3D ActivateTrap { get; set; } = default!;
|
||||
|
||||
[Node] public StaticBody3D GateCollision { get; set; } = default!;
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
SpawnItems();
|
||||
ActivateTrap.BodyEntered += StartBossFight;
|
||||
OxFace.CurrentHP.Sync += BossHPUpdate;
|
||||
HorseFace.CurrentHP.Sync += BossHPUpdate;
|
||||
}
|
||||
|
||||
private void BossHPUpdate(double obj)
|
||||
{
|
||||
if (OxFace.CurrentHP.Value <= 0 && HorseFace.CurrentHP.Value <= 0)
|
||||
GateCollision.Hide();
|
||||
}
|
||||
|
||||
private void SpawnItems()
|
||||
@@ -55,5 +65,10 @@ namespace GameJamDungeon
|
||||
OxFace.Activate();
|
||||
HorseFace.Activate();
|
||||
}
|
||||
|
||||
private void EndBossFight()
|
||||
{
|
||||
GateCollision.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
src/map/dungeon/code/Floor0.cs
Normal file
27
src/map/dungeon/code/Floor0.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Floor0 : Node3D, IDungeonFloor
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] public Marker3D PlayerSpawnPoint { get; set; } = default!;
|
||||
|
||||
[Node] public Marker3D ExitSpawnPoint { get; set; } = default!;
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint()
|
||||
{
|
||||
return PlayerSpawnPoint.GlobalTransform;
|
||||
}
|
||||
|
||||
public Vector3 GetTeleportSpawnPoint()
|
||||
{
|
||||
return ExitSpawnPoint.GlobalPosition;
|
||||
}
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public partial class Overworld : Node3D, IDungeonFloor
|
||||
|
||||
public void InitializeDungeon()
|
||||
{
|
||||
Show();
|
||||
}
|
||||
|
||||
public Transform3D GetPlayerSpawnPoint()
|
||||
|
||||
File diff suppressed because one or more lines are too long
34
src/map/overworld/Floor0.tscn
Normal file
34
src/map/overworld/Floor0.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dl6h1djc27ddl"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/map/dungeon/code/Overworld.cs" id="1_2ce63"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pb22g"]
|
||||
|
||||
[node name="Floor0" type="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.63488, -5.13176)
|
||||
script = ExtResource("1_2ce63")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
|
||||
light_energy = 0.597
|
||||
light_indirect_energy = 1.647
|
||||
light_volumetric_fog_energy = 0.2
|
||||
shadow_enabled = true
|
||||
shadow_opacity = 0.75
|
||||
shadow_blur = 4.224
|
||||
directional_shadow_fade_start = 0.63
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
|
||||
[node name="PlayerSpawnPoint" type="Marker3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(-0.0104718, 0, 0.999945, 0, 1, 0, -0.999945, 0, -0.0104718, 3.6247, 1.51594, 2.81014)
|
||||
|
||||
[node name="ExitSpawnPoint" type="Marker3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.05854, -1.04714, 1.38579)
|
||||
|
||||
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.84864, 0)
|
||||
size = Vector3(10, 1, 10)
|
||||
material = SubResource("StandardMaterial3D_pb22g")
|
||||
@@ -1,20 +1,9 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dvnc26rebk6o0"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dvnc26rebk6o0"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/map/dungeon/code/Overworld.cs" id="1_5hmt3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvj5lwymr02xn" path="res://src/map/overworld/OverworldMap.tscn" id="2_qwsky"]
|
||||
[ext_resource type="PackedScene" uid="uid://d4l4qutp8x40c" path="res://src/npc/rat/NPC.tscn" id="3_4sm8u"]
|
||||
|
||||
[sub_resource type="NavigationMesh" id="NavigationMesh_xplxw"]
|
||||
vertices = PackedVector3Array(-26.8631, 1.06755, -24.5, -26.8631, 1.06755, 24.5, 22.1369, 1.06755, 24.5, 22.1369, 1.06755, -24.5)
|
||||
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dm52s"]
|
||||
albedo_color = Color(1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_6o1o7"]
|
||||
material = SubResource("StandardMaterial3D_dm52s")
|
||||
size = Vector2(50, 50)
|
||||
|
||||
[node name="Overworld" type="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.63488, -5.13176)
|
||||
script = ExtResource("1_5hmt3")
|
||||
@@ -41,13 +30,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25.3664, 0.9708, 17.5532)
|
||||
|
||||
[node name="OverworldMap" parent="." instance=ExtResource("2_qwsky")]
|
||||
|
||||
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="."]
|
||||
navigation_mesh = SubResource("NavigationMesh_xplxw")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="NavigationRegion3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.3631, 0.56755, 0)
|
||||
visible = false
|
||||
mesh = SubResource("PlaneMesh_6o1o7")
|
||||
|
||||
[node name="NPC" parent="." instance=ExtResource("3_4sm8u")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25.0589, 2.01954, -0.291408)
|
||||
|
||||
34
src/map/overworld/Skybox.gdshader
Normal file
34
src/map/overworld/Skybox.gdshader
Normal file
@@ -0,0 +1,34 @@
|
||||
shader_type spatial;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform sampler2D sky_texture : source_color;
|
||||
uniform bool lock_aspect = false;
|
||||
uniform float aspect_ratio = 1.3333333;
|
||||
uniform vec2 fov = vec2(180.0, 90.0);
|
||||
uniform ivec2 tiling = ivec2(1, 1);
|
||||
uniform vec2 offset = vec2(0.0, 0.0);
|
||||
|
||||
varying vec4 BG_COORDS;
|
||||
|
||||
void vertex() {
|
||||
//Camera YX rotation per Basis.get_euler source code
|
||||
float y = atan(VIEW_MATRIX[0][2], VIEW_MATRIX[2][2]);
|
||||
float x = asin(VIEW_MATRIX[1][2]);
|
||||
|
||||
//Map rotation to screen space
|
||||
BG_COORDS.xy = vec2(y * -0.5, x) / PI;
|
||||
BG_COORDS.y += 0.5;
|
||||
|
||||
BG_COORDS.w = fov.y / 180.0;
|
||||
BG_COORDS.z = !lock_aspect ? fov.x / 360.0 : VIEWPORT_SIZE.x / (VIEWPORT_SIZE.y * aspect_ratio) * BG_COORDS.w;
|
||||
|
||||
//Keep background centered vertically when FOV changes
|
||||
BG_COORDS.y *= BG_COORDS.w > 1.0 ? 0.0 : 1.0 - BG_COORDS.w;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv_offset = vec2(-offset.x, offset.y);
|
||||
vec2 uv = (SCREEN_UV + uv_offset) * BG_COORDS.zw + BG_COORDS.xy;
|
||||
uv *= vec2(tiling);
|
||||
ALBEDO = texture(sky_texture, uv).rgb;
|
||||
}
|
||||
Reference in New Issue
Block a user