Dialogue system; ask user if they want to teleport to next floor
This commit is contained in:
39
src/items/consumable/ConsumableItem.cs
Normal file
39
src/items/consumable/ConsumableItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ConsumableItem : Node3D, IInventoryItem
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
|
||||
|
||||
public InventoryItemInfo Info => ConsumableItemInfo;
|
||||
|
||||
[Export]
|
||||
public ConsumableItemInfo ConsumableItemInfo { get; set; }
|
||||
|
||||
[Node] public Sprite3D Sprite { get; set; } = default!;
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Sprite.Texture = ConsumableItemInfo.Texture;
|
||||
Pickup.BodyEntered += OnEntered;
|
||||
}
|
||||
|
||||
public void OnEntered(Node3D body)
|
||||
{
|
||||
if (GameRepo.InventoryItems.Value.Count() >= GameRepo.MaxItemSize)
|
||||
return;
|
||||
|
||||
var inventoryList = GameRepo.InventoryItems.Value.Append(this).ToList();
|
||||
GameRepo.InventoryItems.OnNext(inventoryList);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
34
src/items/consumable/ConsumableItem.tscn
Normal file
34
src/items/consumable/ConsumableItem.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c6w7dpk0hurj0"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItem.cs" id="1_26bad"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemInfo.cs" id="2_g3oo3"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_33w5s"]
|
||||
script = ExtResource("2_g3oo3")
|
||||
Name = ""
|
||||
Description = ""
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7mh0f"]
|
||||
size = Vector3(0.778381, 0.929947, 0.731567)
|
||||
|
||||
[node name="ConsumableItem" type="Node3D"]
|
||||
script = ExtResource("1_26bad")
|
||||
ConsumableItemInfo = SubResource("Resource_33w5s")
|
||||
|
||||
[node name="Pickup" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
|
||||
[node name="Sprite" type="Sprite3D" parent="Pickup"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0322805, 0)
|
||||
pixel_size = 0.001
|
||||
billboard = 2
|
||||
double_sided = false
|
||||
alpha_cut = 1
|
||||
texture_filter = 0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0600509, 0.26725, 0.180481)
|
||||
shape = SubResource("BoxShape3D_7mh0f")
|
||||
8
src/items/consumable/ConsumableItemInfo.cs
Normal file
8
src/items/consumable/ConsumableItemInfo.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ConsumableItemInfo : InventoryItemInfo
|
||||
{
|
||||
}
|
||||
11
src/items/consumable/resources/SteloFragment.tres
Normal file
11
src/items/consumable/resources/SteloFragment.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemInfo" load_steps=3 format=3 uid="uid://75fpkwfp0t0k"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemInfo.cs" id="1_f8ogj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbl5v5i1s3m2u" path="res://src/items/consumable/textures/stelo fragment.PNG" id="1_ic5xm"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_f8ogj")
|
||||
Name = "Stelo Fragment"
|
||||
Description = "A small gathered piece of the former heavens.
|
||||
Restores 30 VT. If VT full, raises MAX VT by 10."
|
||||
Texture = ExtResource("1_ic5xm")
|
||||
BIN
src/items/consumable/textures/stelo fragment.PNG
Normal file
BIN
src/items/consumable/textures/stelo fragment.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
35
src/items/consumable/textures/stelo fragment.PNG.import
Normal file
35
src/items/consumable/textures/stelo fragment.PNG.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dbl5v5i1s3m2u"
|
||||
path.s3tc="res://.godot/imported/stelo fragment.PNG-87ebe2402340a8a359426101165d22a0.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/consumable/textures/stelo fragment.PNG"
|
||||
dest_files=["res://.godot/imported/stelo fragment.PNG-87ebe2402340a8a359426101165d22a0.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
|
||||
Reference in New Issue
Block a user