Dialogue system; ask user if they want to teleport to next floor
This commit is contained in:
@@ -1,26 +1,46 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IThrowableItem : INode3D
|
||||
{
|
||||
public IAnimationPlayer AnimationPlayer { get; set; }
|
||||
}
|
||||
using System.Linq;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ThrowableItem : Node3D, IThrowableItem
|
||||
public partial class ThrowableItem : Node3D, IInventoryItem
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
|
||||
|
||||
[Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public IHitbox Hitbox { get; set; } = default!;
|
||||
|
||||
public void Setup()
|
||||
public InventoryItemInfo Info => ThrowableItemInfo;
|
||||
|
||||
[Export]
|
||||
public ThrowableItemInfo ThrowableItemInfo { get; set; }
|
||||
|
||||
[Node] public Sprite3D Sprite { get; set; } = default!;
|
||||
|
||||
[Node] public Area3D Pickup { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += OnAnimationFinished;
|
||||
Hitbox.Damage = 5;
|
||||
Sprite.Texture = ThrowableItemInfo.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();
|
||||
}
|
||||
|
||||
private void OnAnimationFinished(StringName animName)
|
||||
@@ -28,30 +48,3 @@ public partial class ThrowableItem : Node3D, IThrowableItem
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
public enum ThrowableItemTag
|
||||
{
|
||||
InflictTelluricDamage,
|
||||
InflictAeolicDamage,
|
||||
InflictHydricDamage,
|
||||
InflictIgneousDamage,
|
||||
InflictFerrumDamage,
|
||||
DoubleEXP,
|
||||
RandomWarp,
|
||||
LowerTargetTo1HP,
|
||||
IdentifyAllItemsCostHP,
|
||||
WarpToExitIfFound,
|
||||
RandomNewItem,
|
||||
BasicItem,
|
||||
SwapHPandVTWithEntitiesInRoom,
|
||||
TeleportAllEnemiesToRoom,
|
||||
TurnAllEnemiesIntoHealingItem,
|
||||
KillHalfEnemiesInRoom,
|
||||
AbsorbHPFromAllEnemiesInRoom,
|
||||
HealsAllInRoomToMaxHP,
|
||||
RandomEffect,
|
||||
Add1ATK,
|
||||
Add1DEF,
|
||||
RaiseLevelBy1,
|
||||
BriefImmunity
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://1fl6s352e2ej"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItem.cs" id="1_nac2l"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr8mjn3wahdvp" path="res://src/inventory_menu/cursor.png" id="2_mojlk"]
|
||||
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="3_qpunu"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_qihtb"]
|
||||
size = Vector3(0.371643, 0.289612, 0.286743)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_03cqg"]
|
||||
size = Vector3(0.778381, 0.929947, 0.731567)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_d22ed"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
@@ -45,7 +47,6 @@ _data = {
|
||||
}
|
||||
|
||||
[node name="ThrowableItem" type="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.535839)
|
||||
script = ExtResource("1_nac2l")
|
||||
|
||||
[node name="Hitbox" type="Area3D" parent="."]
|
||||
@@ -55,13 +56,23 @@ collision_layer = 16
|
||||
collision_mask = 16
|
||||
script = ExtResource("3_qpunu")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="Hitbox"]
|
||||
[node name="Sprite" type="Sprite3D" parent="Hitbox"]
|
||||
unique_name_in_owner = true
|
||||
pixel_size = 0.0005
|
||||
billboard = 2
|
||||
texture = ExtResource("2_mojlk")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"]
|
||||
shape = SubResource("BoxShape3D_qihtb")
|
||||
|
||||
[node name="Pickup" type="Area3D" parent="Hitbox"]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox/Pickup"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0600509, 0.26725, 0.180481)
|
||||
shape = SubResource("BoxShape3D_03cqg")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
namespace GameJamDungeon;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ThrowableItemInfo : InventoryItemInfo
|
||||
{
|
||||
[Export]
|
||||
public Godot.Collections.Array<ThrowableItemTag> ThrowableItemTags { get; set; }
|
||||
public Godot.Collections.Array<ThrowableItemTag> ThrowableItemTags { get; set; } = new Godot.Collections.Array<ThrowableItemTag>();
|
||||
}
|
||||
|
||||
26
src/items/throwable/ThrowableItemTag.cs
Normal file
26
src/items/throwable/ThrowableItemTag.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
public enum ThrowableItemTag
|
||||
{
|
||||
InflictTelluricDamage,
|
||||
InflictAeolicDamage,
|
||||
InflictHydricDamage,
|
||||
InflictIgneousDamage,
|
||||
InflictFerrumDamage,
|
||||
DoubleEXP,
|
||||
RandomWarp,
|
||||
LowerTargetTo1HP,
|
||||
IdentifyAllItemsCostHP,
|
||||
WarpToExitIfFound,
|
||||
RandomNewItem,
|
||||
BasicItem,
|
||||
SwapHPandVTWithEntitiesInRoom,
|
||||
TeleportAllEnemiesToRoom,
|
||||
TurnAllEnemiesIntoHealingItem,
|
||||
KillHalfEnemiesInRoom,
|
||||
AbsorbHPFromAllEnemiesInRoom,
|
||||
HealsAllInRoomToMaxHP,
|
||||
RandomEffect,
|
||||
Add1ATK,
|
||||
Add1DEF,
|
||||
RaiseLevelBy1,
|
||||
BriefImmunity
|
||||
}
|
||||
11
src/items/throwable/resources/GeomanticDice.tres
Normal file
11
src/items/throwable/resources/GeomanticDice.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="ThrowableItemInfo" load_steps=3 format=3 uid="uid://bph8c6by4s047"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemInfo.cs" id="1_ewck5"]
|
||||
[ext_resource type="Texture2D" uid="uid://mi70lolgtf3n" path="res://src/items/throwable/textures/GEOMANCER-DICE.png" id="1_jhits"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ewck5")
|
||||
ThrowableItemTags = []
|
||||
Name = "Geomantic Dice"
|
||||
Description = "Inflicts Affinity damage when thrown."
|
||||
Texture = ExtResource("1_jhits")
|
||||
11
src/items/throwable/resources/SpellSignKnowledge.tres
Normal file
11
src/items/throwable/resources/SpellSignKnowledge.tres
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_resource type="Resource" script_class="ThrowableItemInfo" load_steps=3 format=3 uid="uid://qqg0gdcb8fwg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dhfn51smm818x" path="res://src/items/throwable/textures/spell sign - luck.PNG" id="1_3605p"]
|
||||
[ext_resource type="Script" path="res://src/items/throwable/ThrowableItemInfo.cs" id="1_s3pq7"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_s3pq7")
|
||||
ThrowableItemTags = []
|
||||
Name = "Spell Sign: Knowledge"
|
||||
Description = "Doubles experience points earned. Effect is temporary."
|
||||
Texture = ExtResource("1_3605p")
|
||||
BIN
src/items/throwable/textures/GEOMANCER-DICE.png
Normal file
BIN
src/items/throwable/textures/GEOMANCER-DICE.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
35
src/items/throwable/textures/GEOMANCER-DICE.png.import
Normal file
35
src/items/throwable/textures/GEOMANCER-DICE.png.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://mi70lolgtf3n"
|
||||
path.s3tc="res://.godot/imported/GEOMANCER-DICE.png-29575eb9771a13eb2cd0b8f4bb92f76c.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/throwable/textures/GEOMANCER-DICE.png"
|
||||
dest_files=["res://.godot/imported/GEOMANCER-DICE.png-29575eb9771a13eb2cd0b8f4bb92f76c.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
|
||||
BIN
src/items/throwable/textures/spell sign - luck.PNG
Normal file
BIN
src/items/throwable/textures/spell sign - luck.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
35
src/items/throwable/textures/spell sign - luck.PNG.import
Normal file
35
src/items/throwable/textures/spell sign - luck.PNG.import
Normal file
@@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dhfn51smm818x"
|
||||
path.s3tc="res://.godot/imported/spell sign - luck.PNG-f0fcf0db4cd4291911c8889eda080fdc.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/throwable/textures/spell sign - luck.PNG"
|
||||
dest_files=["res://.godot/imported/spell sign - luck.PNG-f0fcf0db4cd4291911c8889eda080fdc.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