Rat dialogue

This commit is contained in:
2024-09-09 14:56:22 -07:00
parent 3e0846223e
commit 6e97058905
64 changed files with 136 additions and 1887 deletions

41
src/npc/Npc.cs Normal file
View File

@@ -0,0 +1,41 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using DialogueManagerRuntime;
using GameJamDungeon;
using Godot;
using System.Linq;
[Meta(typeof(IAutoNode))]
public partial class Npc : Node3D
{
public override void _Notification(int what) => this.Notify(what);
[Node] public Area3D DialogueZone { get; set; } = default!;
[Export]
public Godot.Collections.Array<Resource> DialogueOptions { get; set; } = default!;
private bool _isInDialogueZone = false;
public void OnReady()
{
DialogueZone.BodyEntered += DialogueZone_BodyEntered;
DialogueZone.BodyExited += DialogueZone_BodyExited;
}
private void DialogueZone_BodyExited(Node3D body)
{
_isInDialogueZone = false;
}
private void DialogueZone_BodyEntered(Node3D body)
{
_isInDialogueZone = true;
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed(GameInputs.Throw) && _isInDialogueZone)
DialogueManager.ShowDialogueBalloonScene(DialogueController.DialogueBalloon, DialogueOptions.First(), "introduction");
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cnbdf5rnmss0c"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkBehind.png-d474259823f7e07d28e67fbeafea4ee9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/npc/goddess/GameJam_DevilCapricorn_WalkBehind.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkBehind.png-d474259823f7e07d28e67fbeafea4ee9.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dg22b8xckfhfx"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkForward.png-234fa02af8dbdd9edff550fcb77a7464.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/npc/goddess/GameJam_DevilCapricorn_WalkForward.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkForward.png-234fa02af8dbdd9edff550fcb77a7464.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7aj0ii438hho"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkSide.png-771c2b0d0af534bbb03d6b7aadea21c5.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/npc/goddess/GameJam_DevilCapricorn_WalkSide.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkSide.png-771c2b0d0af534bbb03d6b7aadea21c5.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xu8t0sly6ju7"
path.s3tc="res://.godot/imported/GameJam_DevilCapricorn_WalkSideLeft.png-01b9979d4d466cf12540b33bef3b5d16.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://src/npc/goddess/GameJam_DevilCapricorn_WalkSideLeft.png"
dest_files=["res://.godot/imported/GameJam_DevilCapricorn_WalkSideLeft.png-01b9979d4d466cf12540b33bef3b5d16.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@@ -1,36 +0,0 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
using System;
[Meta(typeof(IAutoNode))]
public partial class Goddess : Node3D
{
public override void _Notification(int what) => this.Notify(what);
[Dependency]
public IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Export]
public Godot.Collections.Array<Texture2D> Sprites { get; set; } = default!;
[Node] public Sprite3D Sprite { get; set; } = default!;
public void OnReady()
{
SetPhysicsProcess(true);
}
public override void _Process(double delta)
{
var cameraPosition = new Vector2(GameRepo.PlayerGlobalPosition.Value.X, GameRepo.PlayerGlobalPosition.Value.Z).Normalized();
var facing = Vector2.Up;
var angle = facing.AngleTo(cameraPosition);
var cameraAngle = (int)Mathf.Floor((angle + Mathf.Pi / 8) / (Mathf.Pi / 4));
cameraAngle = (cameraAngle + 4) % 4;
Sprite.Texture = Sprites[cameraAngle];
}
}

View File

@@ -1,8 +0,0 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://wqh1m4j0n64m"]
[ext_resource type="Shader" path="res://src/npc/goddess/SpriteMelt.gdshader" id="1_k3mvs"]
[resource]
shader = ExtResource("1_k3mvs")
shader_parameter/progress = 0.0
shader_parameter/meltiness = 1.0

View File

@@ -1,20 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://d4l4qutp8x40c"]
[ext_resource type="Script" path="res://src/npc/goddess/Goddess.cs" id="1_4cyto"]
[ext_resource type="Texture2D" uid="uid://bhiyrdo2jk1qg" path="res://src/npc/goddess/goddess.png" id="1_uay1m"]
[ext_resource type="Texture2D" uid="uid://cnbdf5rnmss0c" path="res://src/npc/goddess/GameJam_DevilCapricorn_WalkBehind.png" id="2_d6er1"]
[ext_resource type="Texture2D" uid="uid://dg22b8xckfhfx" path="res://src/npc/goddess/GameJam_DevilCapricorn_WalkForward.png" id="2_twumu"]
[ext_resource type="Texture2D" uid="uid://xu8t0sly6ju7" path="res://src/npc/goddess/GameJam_DevilCapricorn_WalkSideLeft.png" id="3_tds5k"]
[ext_resource type="Texture2D" uid="uid://b7aj0ii438hho" path="res://src/npc/goddess/GameJam_DevilCapricorn_WalkSide.png" id="4_6kg8t"]
[node name="Goddess" type="Node3D"]
script = ExtResource("1_4cyto")
Sprites = Array[Texture2D]([ExtResource("2_d6er1"), ExtResource("3_tds5k"), ExtResource("2_twumu"), ExtResource("4_6kg8t")])
[node name="Sprite" type="Sprite3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1.25, 0, 0, 0, 1.25, 0, 0, 0, 1.25, 0, 0, 0)
gi_mode = 0
billboard = 2
texture_filter = 0
texture = ExtResource("1_uay1m")

View File

@@ -1,114 +0,0 @@
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,unshaded;
uniform vec4 albedo : source_color = vec4(1.0,1.0,1.0,1.0);
uniform sampler2D sprite_sheet : source_color;
/// the count of v_frames, used for the directions
uniform int directions_count = 1;
/// the count of h_frames, used for the animations
uniform int frames_count = 1;
/// the current h_frame
uniform int frame = 1;
/// the angle around vertical axis; the resulting direction looks to (cos y_angle, 0, -sin y_angle)
uniform float y_angle = 0.0;
/// this parameter below specifies which angle is the first frame pointed to.
/// example: if your character has the first frame turned toward north, the starting angle should be pi/2, if it looks to east it can be let to 0.0
uniform float starting_angle = 0.0;
/// this option specify if the direction changes along the vertical axis (default, false) or use the horizontal one instead (true)
uniform bool directions_on_horizontal_axis = false;
/// if you have drawn the sprite sheet so as to make the object rotate clockwise instead of counter-clockwise, set this parameter below true
uniform bool clockwise = false;
void vertex() {
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0],INV_VIEW_MATRIX[1],INV_VIEW_MATRIX[2],MODEL_MATRIX[3]);
}
void fragment() {
//euler angle around the vertical axis
float vert_axis_angle = atan(-VIEW_MATRIX[0][2]/VIEW_MATRIX[2][2]) + (VIEW_MATRIX[0][0] < 0.0?PI:0.0);
//difference
vert_axis_angle += y_angle - starting_angle;
//pinning
vert_axis_angle += PI / float(directions_count);
float direction = floor(vert_axis_angle * float(directions_count) / TAU);
if (clockwise) direction = 1.0 - direction;
float uv_y = direction / float(directions_count);
//texture UV
vec2 texture_uv = directions_on_horizontal_axis?
vec2(
(UV.x / float(directions_count)) + uv_y,
(UV.y + float(frame))/float(frames_count)
):
vec2(
(UV.x + float(frame))/float(frames_count),
(UV.y / float(directions_count)) + uv_y
);
vec4 albedo_tex = texture(sprite_sheet,texture_uv);
//albedo
ALBEDO = albedo.rgb * albedo_tex.rgb;
ALPHA = albedo.a * albedo_tex.a;
}
/************************ FOR GODOT 3 ***************************
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx,unshaded;
uniform vec4 albedo: hint_color = vec4(1.0,1.0,1.0,1.0);
uniform sampler2D sprite_sheet : hint_albedo;
/// the count of v_frames, used for the directions
uniform int directions_count = 1;
/// the count of h_frames, used for the animations
uniform int frames_count = 1;
/// the current h_frame
uniform int frame = 1;
/// the angle around vertical axis; the resulting direction looks to (cos y_angle, 0, -sin y_angle)
uniform float y_angle = 0.0;
/// this parameter below specifies which angle is the first frame pointed to.
/// example: if your character has the first frame turned toward north, the starting angle should be pi/2,
///if it looks to east it can be let to 0.0
uniform float starting_angle = 0.0;
/// this option specify if the direction changes along the vertical axis (default, false) or use the horizontal one instead (true)
uniform bool directions_on_horizontal_axis = false;
/// if you have drawn the sprite sheet so as to make the object rotate clockwise instead of counter-clockwise, set this parameter below true
uniform bool clockwise = false;
void vertex() {
MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],CAMERA_MATRIX[1],CAMERA_MATRIX[2],WORLD_MATRIX[3]);
}
void fragment() {
//euler angle around the vertical axis
float vert_axis_angle = atan(CAMERA_MATRIX[0][2]/CAMERA_MATRIX[0][0]) + (CAMERA_MATRIX[0][0] < 0.0?3.141593:0.0);
//difference
vert_axis_angle += y_angle - starting_angle;
//pinning
vert_axis_angle += 3.141593 / float(directions_count);
float direction = floor(vert_axis_angle * float(directions_count) / 6.283185);
if (clockwise) direction = 1.0 - direction;
float uv_y = direction / float(directions_count);
//texture UV
vec2 texture_uv = directions_on_horizontal_axis?
vec2(
(UV.x / float(directions_count)) + uv_y,
(UV.y + float(frame))/float(frames_count)
):
vec2(
(UV.x + float(frame))/float(frames_count),
(UV.y / float(directions_count)) + uv_y
);
vec4 albedo_tex = texture(sprite_sheet,texture_uv);
//albedo
ALBEDO = albedo.rgb * albedo_tex.rgb;
ALPHA = albedo.a * albedo_tex.a;
}
****************************************************************/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

BIN
src/npc/maiden/PUELLA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bhiyrdo2jk1qg"
path.s3tc="res://.godot/imported/goddess.png-acb5c411edb71ef5e959e417175ba39f.s3tc.ctex"
uid="uid://c414kvmj6wav6"
path.s3tc="res://.godot/imported/PUELLA.png-b84e4cf70035cd95eb206a5a08c4ab61.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://src/npc/goddess/goddess.png"
dest_files=["res://.godot/imported/goddess.png-acb5c411edb71ef5e959e417175ba39f.s3tc.ctex"]
source_file="res://src/npc/maiden/PUELLA.png"
dest_files=["res://.godot/imported/PUELLA.png-b84e4cf70035cd95eb206a5a08c4ab61.s3tc.ctex"]
[params]

View File

@@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=3 uid="uid://d26qwequeef2i"]
[ext_resource type="Texture2D" uid="uid://c414kvmj6wav6" path="res://src/npc/maiden/PUELLA.png" id="1_mlyk6"]
[node name="NPC" type="Node3D"]
[node name="Sprite" type="Sprite3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
gi_mode = 0
pixel_size = 0.005
billboard = 2
texture_filter = 0
texture = ExtResource("1_mlyk6")

30
src/npc/rat/NPC.tscn Normal file
View File

@@ -0,0 +1,30 @@
[gd_scene load_steps=5 format=3 uid="uid://d4l4qutp8x40c"]
[ext_resource type="Texture2D" uid="uid://t7fbfplu2js7" path="res://src/npc/rat/ROYAL_RAT_PRINCEP.png" id="1_0r0wh"]
[ext_resource type="Script" path="res://src/npc/Npc.cs" id="1_cpdf2"]
[ext_resource type="Resource" uid="uid://cf7ycgdiihyh" path="res://src/npc/rat/ratdialogue.dialogue" id="2_uo38w"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_wfhgc"]
radius = 1.5
[node name="NPC" type="Node3D"]
script = ExtResource("1_cpdf2")
DialogueOptions = Array[Resource]([ExtResource("2_uo38w")])
[node name="Sprite" type="Sprite3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
gi_mode = 0
pixel_size = 0.005
billboard = 2
texture_filter = 0
texture = ExtResource("1_0r0wh")
[node name="DialogueZone" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 2
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="DialogueZone"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00131226, 0, -0.00723076)
shape = SubResource("CylinderShape3D_wfhgc")

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dmh2hm1iy6i1x"
path.s3tc="res://.godot/imported/testsprite.png-70f2b03f832bdb736932806bcf06b54e.s3tc.ctex"
uid="uid://t7fbfplu2js7"
path.s3tc="res://.godot/imported/ROYAL_RAT_PRINCEP.png-e4eeb4a5bba938a6dc238bcabe55375f.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://src/npc/testsprite.png"
dest_files=["res://.godot/imported/testsprite.png-70f2b03f832bdb736932806bcf06b54e.s3tc.ctex"]
source_file="res://src/npc/rat/ROYAL_RAT_PRINCEP.png"
dest_files=["res://.godot/imported/ROYAL_RAT_PRINCEP.png-e4eeb4a5bba938a6dc238bcabe55375f.s3tc.ctex"]
[params]

View File

@@ -0,0 +1,10 @@
~ introduction
Royal Rat Princep, Tekohcyo: I do not know thee but I perceive thine sorrows vividly,
for I am embraced by their brethren.
Royal Rat Princep, Tekohcyo: Though it be in mind only, I am traitor to mine country and family.
But a plague on the mind is a plague on one's world is it not?
Royal Rat Princep, Tekohcyo: Alas, the tower has rejected me, so here I reside.
Unable to return home, but unable to climb it.
=> END

View File

@@ -0,0 +1,15 @@
[remap]
importer="dialogue_manager_compiler_12"
type="Resource"
uid="uid://cf7ycgdiihyh"
path="res://.godot/imported/ratdialogue.dialogue-44b9fe9da69f8da8a6bfdeb5429ef4a3.tres"
[deps]
source_file="res://src/npc/rat/ratdialogue.dialogue"
dest_files=["res://.godot/imported/ratdialogue.dialogue-44b9fe9da69f8da8a6bfdeb5429ef4a3.tres"]
[params]
defaults=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB