Катсцена для первого дня

This commit is contained in:
Евгений Титаренко 2024-08-25 16:02:48 +03:00
parent 47df3f9165
commit 32f09f08f3
6 changed files with 126 additions and 2 deletions

View file

@ -1,4 +1,4 @@
[gd_resource type="AudioBusLayout" load_steps=5 format=3 uid="uid://l2ld5cr1ew0r"] [gd_resource type="AudioBusLayout" load_steps=6 format=3 uid="uid://l2ld5cr1ew0r"]
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_728t0"] [sub_resource type="AudioEffectReverb" id="AudioEffectReverb_728t0"]
resource_name = "Reverb" resource_name = "Reverb"
@ -16,6 +16,10 @@ room_size = 0.1
resource_name = "StereoEnhance" resource_name = "StereoEnhance"
surround = 1.0 surround = 1.0
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_g1p66"]
resource_name = "Reverb"
room_size = 0.1
[resource] [resource]
bus/1/name = &"Music" bus/1/name = &"Music"
bus/1/solo = false bus/1/solo = false
@ -43,3 +47,11 @@ bus/3/effect/0/effect = SubResource("AudioEffectReverb_y6xta")
bus/3/effect/0/enabled = true bus/3/effect/0/enabled = true
bus/3/effect/1/effect = SubResource("AudioEffectStereoEnhance_2b60j") bus/3/effect/1/effect = SubResource("AudioEffectStereoEnhance_2b60j")
bus/3/effect/1/enabled = true bus/3/effect/1/enabled = true
bus/4/name = &"Spook"
bus/4/solo = false
bus/4/mute = false
bus/4/bypass_fx = false
bus/4/volume_db = 0.0
bus/4/send = &"Master"
bus/4/effect/0/effect = SubResource("AudioEffectReverb_g1p66")
bus/4/effect/0/enabled = true

37
prefabs/Day1Cutscene.tscn Normal file
View file

@ -0,0 +1,37 @@
[gd_scene load_steps=6 format=3 uid="uid://ca2cali2s1y6x"]
[ext_resource type="SpriteFrames" uid="uid://bwssm27bm14s7" path="res://resources/sprites/npcs/captain.tres" id="1_pra77"]
[ext_resource type="Script" path="res://scripts/Day1Cutscene.cs" id="1_ryay5"]
[ext_resource type="PackedScene" uid="uid://c5ndo6b0unkst" path="res://prefabs/NPC.tscn" id="3_c46dh"]
[ext_resource type="AudioStream" uid="uid://dtbu8f2sp1lql" path="res://resources/sounds/spook8.wav" id="4_dfp4a"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yoe65"]
size = Vector2(53, 20)
[node name="Day1Cutscene" type="Node2D"]
script = ExtResource("1_ryay5")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = ExtResource("1_pra77")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(-16.5, 0)
shape = SubResource("RectangleShape2D_yoe65")
[node name="NPC1" parent="." instance=ExtResource("3_c46dh")]
position = Vector2(225, -339)
NPCName = "Eugene"
DialogLines = ["Captain, I have found a quite strange signal.", "Listen"]
[node name="NPC2" parent="." instance=ExtResource("3_c46dh")]
position = Vector2(361, -342)
NPCName = "Captain"
DialogLines = ["...", "Quite intresting", "Process this signal on main computer", "We will set cource on source of this signal", "Keep up the good work"]
[node name="Spook" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_dfp4a")
bus = &"Spook"
[connection signal="body_entered" from="Area2D" to="." method="Stage1"]

BIN
resources/sounds/spook8.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dtbu8f2sp1lql"
path="res://.godot/imported/spook8.wav-4324397a78d4da0b1262a5789ce80e63.sample"
[deps]
source_file="res://resources/sounds/spook8.wav"
dest_files=["res://.godot/imported/spook8.wav-4324397a78d4da0b1262a5789ce80e63.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

50
scripts/Day1Cutscene.cs Normal file
View file

@ -0,0 +1,50 @@
using Godot;
using System;
public partial class Day1Cutscene : Node2D
{
private Player _player;
private NPC _npc1;
private NPC _npc2;
private AudioStreamPlayer _spook;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_npc1 = (NPC)FindChild("NPC1");
_npc2 = (NPC)FindChild("NPC2");
_spook = (AudioStreamPlayer)FindChild("Spook");
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void Stage1(Node2D body)
{
if (body is Player player)
{
_player = player;
player.InteractableObjects.Add(_npc1);
player.CurrentState = Player.State.ChatWithNPC;
}
}
public void Stage2()
{
_player.CurrentState = Player.State.Wait;
_player.InteractableObjects.Remove(_npc1);
AudioServer.SetBusVolumeDb(0, -20);
_spook.Play();
_player.InteractableObjects.Add(_npc2);
}
public void Stage3()
{
AudioServer.SetBusVolumeDb(0, 0);
_player.CurrentState = Player.State.ChatWithNPC;
}
}

View file

@ -170,7 +170,8 @@ public partial class Player : CharacterBody2D
ShowChatLog(delta); ShowChatLog(delta);
break; break;
case State.Wait: case State.Wait:
_camera.Offset = _cameraDefaultPosition; // _camera.Offset = _cameraDefaultPosition;
HideChatLog(delta);
break; break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();