Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 26f6a619cb | |||
| ce48f3b9d7 | |||
| 54796252ce | |||
| 054115aa89 | |||
| f5e47e9f5e | |||
| 99ed6375a2 | |||
| 6888499b78 |
@@ -41,8 +41,8 @@ jobs:
|
|||||||
|
|
||||||
# Test:
|
# Test:
|
||||||
# runs-on: godot
|
# runs-on: godot
|
||||||
## env:
|
# env:
|
||||||
## RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
# RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
||||||
# steps:
|
# steps:
|
||||||
# - name: Checkout with LFS
|
# - name: Checkout with LFS
|
||||||
# uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
|
# uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
|
||||||
@@ -54,6 +54,14 @@ jobs:
|
|||||||
# godot-version: ${GODOT_VERSION}
|
# godot-version: ${GODOT_VERSION}
|
||||||
# dotnet-version: ${DOTNET_VERSION}
|
# dotnet-version: ${DOTNET_VERSION}
|
||||||
#
|
#
|
||||||
|
# - name: 🔬 Verify Setup
|
||||||
|
# run: |
|
||||||
|
# dotnet --version
|
||||||
|
# ${{ steps.setup-godot.outputs.godot_bin }} --version
|
||||||
|
#
|
||||||
|
# - name: 🧑🔬 Generate .NET Bindings
|
||||||
|
# run: ${{ steps.setup-godot.outputs.godot_bin }} --headless --build-solutions --quit || exit 0
|
||||||
|
#
|
||||||
# - name: Run C# Tests
|
# - name: Run C# Tests
|
||||||
# env:
|
# env:
|
||||||
# GODOT_BIN: ${{ steps.setup-godot.outputs.godot_bin }}
|
# GODOT_BIN: ${{ steps.setup-godot.outputs.godot_bin }}
|
||||||
@@ -79,6 +87,61 @@ jobs:
|
|||||||
# uses: actions/upload-artifact@v3-node20
|
# uses: actions/upload-artifact@v3-node20
|
||||||
# with:
|
# with:
|
||||||
# name: Test Report
|
# name: Test Report
|
||||||
|
# path: ${{ github.workspace }}/reports/test-result.html
|
||||||
|
#
|
||||||
|
# OtherTest:
|
||||||
|
# runs-on: godot
|
||||||
|
# env:
|
||||||
|
# RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
||||||
|
# steps:
|
||||||
|
# - name: Checkout with LFS
|
||||||
|
# uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
|
||||||
|
#
|
||||||
|
# - uses: actions/setup-dotnet@v5
|
||||||
|
# name: 💽 Setup .NET SDK
|
||||||
|
# with:
|
||||||
|
# dotnet-version: ${DOTNET_VERSION}
|
||||||
|
#
|
||||||
|
# - name: 📦 Restore Dependencies
|
||||||
|
# run: |
|
||||||
|
# dotnet --version
|
||||||
|
# dotnet restore
|
||||||
|
# dotnet build
|
||||||
|
# dotnet list package
|
||||||
|
#
|
||||||
|
# - uses: chickensoft-games/setup-godot@v2
|
||||||
|
# name: 🤖 Setup Godot
|
||||||
|
# with:
|
||||||
|
# # Version must include major, minor, and patch, and be >= 4.0.0
|
||||||
|
# # Pre-release label is optional.
|
||||||
|
# version: ${GODOT_VERSION}
|
||||||
|
# # Use .NET-enabled version of Godot (the default is also true).
|
||||||
|
# use-dotnet: true
|
||||||
|
# # Include the Godot Export Templates (the default is false).
|
||||||
|
# include-templates: true
|
||||||
|
#
|
||||||
|
# - name: 🔬 Verify Setup
|
||||||
|
# run: |
|
||||||
|
# dotnet --version
|
||||||
|
# godot --version
|
||||||
|
#
|
||||||
|
# - name: 🧑🔬 Generate .NET Bindings
|
||||||
|
# run: godot --headless --build-solutions --quit || exit 0
|
||||||
|
#
|
||||||
|
# - name: 🦺 Build Projects
|
||||||
|
# run: dotnet build --configuration Release
|
||||||
|
#
|
||||||
|
# - name: Run C# Tests
|
||||||
|
# env:
|
||||||
|
# GODOT_BIN: godot
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# dotnet test --no-build --settings .runsettings --results-directory ./reports --logger "console;verbosity=normal" --logger "trx;LogFileName=results.xml" -- GdUnit4.Parameters="--verbose --headless --import"
|
||||||
|
#
|
||||||
|
# - name: Upload test report
|
||||||
|
# uses: actions/upload-artifact@v3-node20
|
||||||
|
# with:
|
||||||
|
# name: Test Report
|
||||||
# path: ${{ github.workspace }}/reports/test-result.html
|
# path: ${{ github.workspace }}/reports/test-result.html
|
||||||
|
|
||||||
Export:
|
Export:
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
<RootNamespace>Movementtests</RootNamespace>
|
<RootNamespace>Movementtests</RootNamespace>
|
||||||
|
<!-- Catch compiler-mismatch issues with the Introspection generator -->
|
||||||
|
<WarningsAsErrors>CS9057</WarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include=".runsettings" />
|
<Content Include=".runsettings" />
|
||||||
@@ -131,6 +133,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="RustyOptions" Version="0.10.1" />
|
<PackageReference Include="RustyOptions" Version="0.10.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Chickensoft.GodotNodeInterfaces" Version="3.0.12" />
|
||||||
|
<PackageReference Include="Chickensoft.Introspection" Version="3.0.2" />
|
||||||
|
<PackageReference Include="Chickensoft.Introspection.Generator" Version="3.0.2" PrivateAssets="all" OutputItemType="analyzer" />
|
||||||
|
<PackageReference Include="Chickensoft.AutoInject" Version="2.12.8" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="Chickensoft.AutoInject.Analyzers" Version="2.12.8" PrivateAssets="all" OutputItemType="analyzer" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="addons/forge/Forge.props" />
|
<Import Project="addons/forge/Forge.props" />
|
||||||
|
|
||||||
<!-- gdUnit4 package dependencies -->
|
<!-- gdUnit4 package dependencies -->
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ func _input(event : InputEvent) -> void:
|
|||||||
if event.is_action_released("ui_cancel"):
|
if event.is_action_released("ui_cancel"):
|
||||||
if sub_menu:
|
if sub_menu:
|
||||||
_close_sub_menu()
|
_close_sub_menu()
|
||||||
else:
|
# else:
|
||||||
get_tree().quit()
|
# get_tree().quit()
|
||||||
if event.is_action_released("ui_accept") and get_viewport().gui_get_focus_owner() == null:
|
if event.is_action_released("ui_accept") and get_viewport().gui_get_focus_owner() == null:
|
||||||
%MenuButtonsBoxContainer.focus_first()
|
%MenuButtonsBoxContainer.focus_first()
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,8 @@ public partial class InventoryManager : Node
|
|||||||
|
|
||||||
public Dictionary<WeaponSystem.WeaponEvent, HashSet<Resource>> WeaponEventsInventory { get; } = [];
|
public Dictionary<WeaponSystem.WeaponEvent, HashSet<Resource>> WeaponEventsInventory { get; } = [];
|
||||||
|
|
||||||
public static InventoryManager Instance { get; private set; }
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
Instance = this;
|
|
||||||
WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick] = new HashSet<Resource>();
|
WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick] = new HashSet<Resource>();
|
||||||
WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying] = new HashSet<Resource>();
|
WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying] = new HashSet<Resource>();
|
||||||
WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying] = new HashSet<Resource>();
|
WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying] = new HashSet<Resource>();
|
||||||
|
|||||||
88
maps/_templates/MainSceneTemplate.cs
Normal file
88
maps/_templates/MainSceneTemplate.cs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Chickensoft.AutoInject;
|
||||||
|
using Chickensoft.Introspection;
|
||||||
|
using Movementtests.interfaces;using Movementtests.managers;
|
||||||
|
using Movementtests.systems;
|
||||||
|
|
||||||
|
[Meta(
|
||||||
|
typeof(IAutoOn),
|
||||||
|
typeof(IAutoConnect),
|
||||||
|
typeof(IProvider)
|
||||||
|
)]
|
||||||
|
public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
|
||||||
|
{
|
||||||
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
|
[Node("PlayerFellRespawn")] private Marker3D? PlayerRespawnMarker { get; set; }
|
||||||
|
private AnimationPlayer? _animationPlayer;
|
||||||
|
private Node3D? _respawnabble;
|
||||||
|
|
||||||
|
private Area3D? _playerFellPlane;
|
||||||
|
private Area3D? _deathPlane;
|
||||||
|
|
||||||
|
public required InventoryManager InventoryManager { get; set; }
|
||||||
|
InventoryManager IProvide<InventoryManager>.Value() => InventoryManager;
|
||||||
|
|
||||||
|
public void OnReady()
|
||||||
|
{
|
||||||
|
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
|
|
||||||
|
_playerFellPlane = GetNode<Area3D>("PlayerFellTP");
|
||||||
|
_deathPlane = GetNode<Area3D>("DeathPlane");
|
||||||
|
|
||||||
|
if (PlayerRespawnMarker == null) throw new Exception("Player respawn marker is null");
|
||||||
|
if (_animationPlayer == null) throw new Exception("Animation player is null");
|
||||||
|
if (_playerFellPlane == null) throw new Exception("Player reset plane is null");
|
||||||
|
if (_deathPlane == null) throw new Exception("Enemy death plane is null");
|
||||||
|
|
||||||
|
_playerFellPlane.BodyEntered += StartResetPlayerAnimation;
|
||||||
|
_deathPlane.BodyEntered += KillEnemy;
|
||||||
|
|
||||||
|
InventoryManager = new InventoryManager();
|
||||||
|
AddChild(InventoryManager);
|
||||||
|
this.Provide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnProvided()
|
||||||
|
{
|
||||||
|
// You can optionally implement this method. It gets called once you call
|
||||||
|
// this.Provide() to inform AutoInject that the provided values are now
|
||||||
|
// available.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetPlayerPosition()
|
||||||
|
{
|
||||||
|
if (_respawnabble == null || PlayerRespawnMarker == null) throw new Exception("Player or respawn marker is null");
|
||||||
|
_respawnabble.GlobalPosition = PlayerRespawnMarker.GlobalPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartResetPlayerAnimation(Node3D body)
|
||||||
|
{
|
||||||
|
if (body is WeaponSystem weapon)
|
||||||
|
{
|
||||||
|
if (PlayerRespawnMarker == null) throw new Exception("Respawn marker is null");
|
||||||
|
weapon.GlobalPosition = PlayerRespawnMarker.GlobalPosition;
|
||||||
|
weapon.SetLinearVelocity(Vector3.Down);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_respawnabble = body as PlayerController;
|
||||||
|
if (_respawnabble == null || _animationPlayer == null) throw new Exception("Player or anim player is null");
|
||||||
|
_animationPlayer.Play("player_fell");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void KillEnemy(Node3D body)
|
||||||
|
{
|
||||||
|
if (body is not IKillable killable)
|
||||||
|
{
|
||||||
|
body.QueueFree();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (killable is not IHealthable healthable)
|
||||||
|
{
|
||||||
|
body.QueueFree();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
killable.Kill(healthable);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
maps/_templates/MainSceneTemplate.cs.uid
Normal file
1
maps/_templates/MainSceneTemplate.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://br0f18u1iou2d
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
extends Node3D
|
|
||||||
|
|
||||||
|
|
||||||
@onready var player_fell_respawn: Marker3D = $PlayerFellRespawn
|
|
||||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
|
||||||
|
|
||||||
var _player: Node3D
|
|
||||||
|
|
||||||
func _on_player_fell_tp_body_entered(body: Node3D) -> void:
|
|
||||||
_player = body
|
|
||||||
animation_player.play("player_fell")
|
|
||||||
|
|
||||||
|
|
||||||
func reset_player_position() -> void:
|
|
||||||
if _player == null:
|
|
||||||
return
|
|
||||||
_player.position = player_fell_respawn.position
|
|
||||||
|
|
||||||
|
|
||||||
func _on_death_plane_body_entered(body: Node3D) -> void:
|
|
||||||
body.queue_free()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://beof168aw2acj
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene format=3 uid="uid://55wehh6xombr"]
|
[gd_scene format=3 uid="uid://55wehh6xombr"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://beof168aw2acj" path="res://maps/_templates/main_scene_template.gd" id="1_5g5a0"]
|
[ext_resource type="Script" uid="uid://br0f18u1iou2d" path="res://maps/_templates/MainSceneTemplate.cs" id="1_5g5a0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bkcsjsk2ciff" path="res://addons/maaacks_game_template/base/scenes/music_players/background_music_player.tscn" id="2_roiv2"]
|
[ext_resource type="PackedScene" uid="uid://bkcsjsk2ciff" path="res://addons/maaacks_game_template/base/scenes/music_players/background_music_player.tscn" id="2_roiv2"]
|
||||||
[ext_resource type="AudioStream" uid="uid://f8cvr5s041ej" path="res://assets/audio/ambiance/637083__nox_sound__ambiance_nature_night_cricket_calm_loop_stereo.wav" id="3_boadi"]
|
[ext_resource type="AudioStream" uid="uid://f8cvr5s041ej" path="res://assets/audio/ambiance/637083__nox_sound__ambiance_nature_night_cricket_calm_loop_stereo.wav" id="3_boadi"]
|
||||||
[ext_resource type="Script" uid="uid://cupqhe3qv7ero" path="res://tools/general_manager.gd" id="3_k6got"]
|
[ext_resource type="Script" uid="uid://cupqhe3qv7ero" path="res://tools/general_manager.gd" id="3_k6got"]
|
||||||
@@ -237,7 +237,7 @@ tracks/6/keys = {
|
|||||||
"transitions": PackedFloat32Array(1),
|
"transitions": PackedFloat32Array(1),
|
||||||
"values": [{
|
"values": [{
|
||||||
"args": [],
|
"args": [],
|
||||||
"method": &"reset_player_position"
|
"method": &"ResetPlayerPosition"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,6 +300,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 300, 0)
|
|||||||
[node name="PlayerFellTP" type="Area3D" parent="." unique_id=1277888169]
|
[node name="PlayerFellTP" type="Area3D" parent="." unique_id=1277888169]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -200, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -200, 0)
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
collision_mask = 65537
|
||||||
monitorable = false
|
monitorable = false
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerFellTP" unique_id=1866249040]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerFellTP" unique_id=1866249040]
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ size = Vector3(6.75, 8.25, 7.25)
|
|||||||
|
|
||||||
[node name="Main" unique_id=955321579 instance=ExtResource("1_jyq54")]
|
[node name="Main" unique_id=955321579 instance=ExtResource("1_jyq54")]
|
||||||
|
|
||||||
[node name="DirectionalLight3D" parent="." index="5" unique_id=1357990191]
|
[node name="DirectionalLight3D" parent="." index="6" unique_id=1357990191]
|
||||||
transform = Transform3D(-0.1772511, 0.44628847, 0.87715954, 0.49540228, -0.72966087, 0.4713508, 0.85038733, 0.51809436, -0.09175911, 0, 0, 0)
|
transform = Transform3D(-0.1772511, 0.44628847, 0.87715954, 0.49540228, -0.72966087, 0.4713508, 0.85038733, 0.51809436, -0.09175911, 0, 0, 0)
|
||||||
|
|
||||||
[node name="Greybox" type="CSGCombiner3D" parent="." index="7" unique_id=2082385716]
|
[node name="Greybox" type="CSGCombiner3D" parent="." index="7" unique_id=2082385716]
|
||||||
@@ -907,9 +907,9 @@ light_energy = 8.571
|
|||||||
omni_range = 7.0
|
omni_range = 7.0
|
||||||
|
|
||||||
[node name="OmniLight3D29" type="OmniLight3D" parent="Lights" index="24" unique_id=2143811783]
|
[node name="OmniLight3D29" type="OmniLight3D" parent="Lights" index="24" unique_id=2143811783]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 25.5, -16.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 16.75, -18.75)
|
||||||
light_energy = 4.004
|
light_energy = 4.004
|
||||||
omni_range = 7.0
|
omni_range = 9.25
|
||||||
|
|
||||||
[node name="OmniLight3D20" type="OmniLight3D" parent="Lights" index="25" unique_id=1665621589]
|
[node name="OmniLight3D20" type="OmniLight3D" parent="Lights" index="25" unique_id=1665621589]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -35.25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -37, 24.5, -35.25)
|
||||||
@@ -934,14 +934,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -33.5, 24.5, -47)
|
|||||||
light_energy = 2.725
|
light_energy = 2.725
|
||||||
omni_range = 10.0
|
omni_range = 10.0
|
||||||
|
|
||||||
[node name="OmniLight3D25" type="OmniLight3D" parent="Lights" index="30" unique_id=727558952]
|
[node name="OmniLight3D34" type="OmniLight3D" parent="Lights" index="30" unique_id=2065211844]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -36.25, 13.75, -45.5)
|
||||||
|
light_energy = 2.725
|
||||||
|
omni_range = 10.0
|
||||||
|
|
||||||
|
[node name="OmniLight3D25" type="OmniLight3D" parent="Lights" index="31" unique_id=727558952]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28, 24.5, -51)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28, 24.5, -51)
|
||||||
|
|
||||||
[node name="OmniLight3D26" type="OmniLight3D" parent="Lights" index="31" unique_id=1646376304]
|
[node name="OmniLight3D26" type="OmniLight3D" parent="Lights" index="32" unique_id=1646376304]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5)
|
||||||
omni_range = 7.0
|
omni_range = 7.0
|
||||||
|
|
||||||
[node name="OmniLight3D27" type="OmniLight3D" parent="Lights" index="32" unique_id=1849438050]
|
[node name="OmniLight3D27" type="OmniLight3D" parent="Lights" index="33" unique_id=1849438050]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20, 24.5, -51.5)
|
||||||
omni_range = 4.5
|
omni_range = 4.5
|
||||||
|
|
||||||
@@ -1047,10 +1052,10 @@ tuto_text = "Select next level when ready"
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.875, 1.125, -4.625)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.875, 1.125, -4.625)
|
||||||
shape = SubResource("BoxShape3D_7hd1j")
|
shape = SubResource("BoxShape3D_7hd1j")
|
||||||
|
|
||||||
[node name="Player" parent="." index="11" unique_id=1309399929]
|
[node name="Player" parent="." index="12" unique_id=1309399929]
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, -0.5, 0.4102497, 0.5415039)
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, -0.5, 0.4102497, 0.5415039)
|
||||||
HasSword = false
|
HasSword = false
|
||||||
HasParry = false
|
HasParry = false
|
||||||
|
|
||||||
[node name="PlayerFellRespawn" parent="." index="12" unique_id=479136076]
|
[node name="PlayerFellRespawn" parent="." index="13" unique_id=479136076]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.25, -1.25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.25, -1.25)
|
||||||
|
|||||||
@@ -112,5 +112,5 @@ tuto_text = "Try to survive!"
|
|||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0.625, -1.875)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0.625, -1.875)
|
||||||
shape = SubResource("BoxShape3D_lthgu")
|
shape = SubResource("BoxShape3D_lthgu")
|
||||||
|
|
||||||
[node name="Player" parent="." index="15" unique_id=1309399929]
|
[node name="Player" parent="." index="16" unique_id=1309399929]
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
||||||
|
|||||||
@@ -1,54 +1,67 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Chickensoft.AutoInject;
|
||||||
|
using Chickensoft.Introspection;
|
||||||
using Gamesmiths.Forge.Effects;
|
using Gamesmiths.Forge.Effects;
|
||||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Movementtests.managers;
|
using Movementtests.managers;
|
||||||
using Movementtests.systems;
|
using Movementtests.systems;
|
||||||
|
|
||||||
[Tool, GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_crate.png")]
|
|
||||||
|
[Tool, GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_crate.png"), Meta(typeof(IAutoNode))]
|
||||||
public partial class InventoryUi : Control
|
public partial class InventoryUi : Control
|
||||||
{
|
{
|
||||||
private AbilitySelection _startedFlyingSelection;
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
private AbilitySelection _whileFlyingSelection;
|
|
||||||
private AbilitySelection _stoppedFlyingSelection;
|
|
||||||
|
|
||||||
public override void _Ready()
|
#region Dependencies
|
||||||
|
[Dependency]
|
||||||
|
public InventoryManager InventoryManager => this.DependOn<InventoryManager>();
|
||||||
|
#endregion Dependencies
|
||||||
|
|
||||||
|
#region Nodes
|
||||||
|
[Node]
|
||||||
|
public required AbilitySelection StartedFlying { get; set; }
|
||||||
|
[Node]
|
||||||
|
public required AbilitySelection WhileFlying { get; set; }
|
||||||
|
[Node]
|
||||||
|
public required AbilitySelection StoppedFlying { get; set; }
|
||||||
|
#endregion Nodes
|
||||||
|
|
||||||
|
public void OnReady()
|
||||||
{
|
{
|
||||||
_startedFlyingSelection = GetNode<AbilitySelection>("%StartedFlying");
|
StartedFlying.AbilityAdded += AddAbilityForEvent;
|
||||||
_whileFlyingSelection = GetNode<AbilitySelection>("%WhileFlying");
|
WhileFlying.AbilityAdded += AddAbilityForEvent;
|
||||||
_stoppedFlyingSelection = GetNode<AbilitySelection>("%StoppedFlying");
|
StoppedFlying.AbilityAdded += AddAbilityForEvent;
|
||||||
|
|
||||||
_startedFlyingSelection.Initialize(InventoryManager.Instance.WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying]);
|
StartedFlying.AbilityRemoved += RemoveAbilityForEvent;
|
||||||
_whileFlyingSelection.Initialize(InventoryManager.Instance.WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick]);
|
WhileFlying.AbilityRemoved += RemoveAbilityForEvent;
|
||||||
_stoppedFlyingSelection.Initialize(InventoryManager.Instance.WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying]);
|
StoppedFlying.AbilityRemoved += RemoveAbilityForEvent;
|
||||||
|
|
||||||
_startedFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
|
||||||
_whileFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
|
||||||
_stoppedFlyingSelection.AbilityAdded += AddAbilityForEvent;
|
|
||||||
|
|
||||||
_startedFlyingSelection.AbilityRemoved += RemoveAbilityForEvent;
|
|
||||||
_whileFlyingSelection.AbilityRemoved += RemoveAbilityForEvent;
|
|
||||||
_stoppedFlyingSelection.AbilityRemoved += RemoveAbilityForEvent;
|
|
||||||
|
|
||||||
InventoryManager.Instance.WeaponEventAbilityAdded += OnWeaponEventInventoryAdded;
|
|
||||||
InventoryManager.Instance.WeaponEventAbilityRemoved += OnWeaponEventInventoryRemoved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _ExitTree()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
InventoryManager.Instance.WeaponEventAbilityAdded -= OnWeaponEventInventoryAdded;
|
StartedFlying.Initialize(InventoryManager.WeaponEventsInventory[WeaponSystem.WeaponEvent.StartedFlying]);
|
||||||
InventoryManager.Instance.WeaponEventAbilityRemoved -= OnWeaponEventInventoryRemoved;
|
WhileFlying.Initialize(InventoryManager.WeaponEventsInventory[WeaponSystem.WeaponEvent.FlyingTick]);
|
||||||
base._ExitTree();
|
StoppedFlying.Initialize(InventoryManager.WeaponEventsInventory[WeaponSystem.WeaponEvent.StoppedFlying]);
|
||||||
|
|
||||||
|
InventoryManager.WeaponEventAbilityAdded += OnWeaponEventInventoryAdded;
|
||||||
|
InventoryManager.WeaponEventAbilityRemoved += OnWeaponEventInventoryRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnExitTree()
|
||||||
|
{
|
||||||
|
InventoryManager.WeaponEventAbilityAdded -= OnWeaponEventInventoryAdded;
|
||||||
|
InventoryManager.WeaponEventAbilityRemoved -= OnWeaponEventInventoryRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAbilityForEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
|
public void AddAbilityForEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
|
||||||
{
|
{
|
||||||
InventoryManager.Instance.AddAbilityForWeaponEvent(forEvent, abilityBehavior);
|
InventoryManager.AddAbilityForWeaponEvent(forEvent, abilityBehavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveAbilityForEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
|
public void RemoveAbilityForEvent(WeaponSystem.WeaponEvent forEvent, ForgeAbilityBehavior abilityBehavior)
|
||||||
{
|
{
|
||||||
InventoryManager.Instance.RemoveAbilityForWeaponEvent(forEvent, abilityBehavior);
|
InventoryManager.RemoveAbilityForWeaponEvent(forEvent, abilityBehavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnWeaponEventInventoryAdded(WeaponEventAbilityData data)
|
public void OnWeaponEventInventoryAdded(WeaponEventAbilityData data)
|
||||||
@@ -71,9 +84,9 @@ public partial class InventoryUi : Control
|
|||||||
{
|
{
|
||||||
var abilitiesSelectionsMap = new Dictionary<WeaponSystem.WeaponEvent, AbilitySelection>
|
var abilitiesSelectionsMap = new Dictionary<WeaponSystem.WeaponEvent, AbilitySelection>
|
||||||
{
|
{
|
||||||
{ WeaponSystem.WeaponEvent.StartedFlying, _startedFlyingSelection },
|
{ WeaponSystem.WeaponEvent.StartedFlying, StartedFlying },
|
||||||
{ WeaponSystem.WeaponEvent.StoppedFlying, _stoppedFlyingSelection },
|
{ WeaponSystem.WeaponEvent.StoppedFlying, StoppedFlying },
|
||||||
{ WeaponSystem.WeaponEvent.FlyingTick, _whileFlyingSelection },
|
{ WeaponSystem.WeaponEvent.FlyingTick, WhileFlying },
|
||||||
};
|
};
|
||||||
|
|
||||||
return abilitiesSelectionsMap[forEvent];
|
return abilitiesSelectionsMap[forEvent];
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ Shaker="*uid://c7flmumgr5w3u"
|
|||||||
CsgToolkitAutoload="*uid://w8ad8q4lneis"
|
CsgToolkitAutoload="*uid://w8ad8q4lneis"
|
||||||
"Forge Bootstrap"="*uid://ba8fquhtwu5mu"
|
"Forge Bootstrap"="*uid://ba8fquhtwu5mu"
|
||||||
GlobalHelpers="*uid://dqcm83o8e66a2"
|
GlobalHelpers="*uid://dqcm83o8e66a2"
|
||||||
InventoryManager="*uid://cgwhrwfqsiing"
|
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ metadata/_custom_type_script = "uid://jitubgv6judn"
|
|||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_abfq8"]
|
[sub_resource type="Resource" id="Resource_abfq8"]
|
||||||
script = ExtResource("3_cb2lu")
|
script = ExtResource("3_cb2lu")
|
||||||
Modifier = 20.0
|
Modifier = 5.0
|
||||||
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_ue7xq"]
|
[sub_resource type="Resource" id="Resource_ue7xq"]
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Chickensoft.AutoInject;
|
||||||
|
using Chickensoft.Introspection;
|
||||||
using Gamesmiths.Forge.Abilities;
|
using Gamesmiths.Forge.Abilities;
|
||||||
using Gamesmiths.Forge.Attributes;
|
using Gamesmiths.Forge.Attributes;
|
||||||
using Gamesmiths.Forge.Core;
|
using Gamesmiths.Forge.Core;
|
||||||
@@ -35,7 +37,8 @@ using Node = Godot.Node;
|
|||||||
|
|
||||||
public record struct EmpoweredActionPayload;
|
public record struct EmpoweredActionPayload;
|
||||||
|
|
||||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_character.png")]
|
|
||||||
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_character.png"), Meta(typeof(IAutoNode))]
|
||||||
public partial class PlayerController : CharacterBody3D,
|
public partial class PlayerController : CharacterBody3D,
|
||||||
IDamageable,
|
IDamageable,
|
||||||
IDamageDealer,
|
IDamageDealer,
|
||||||
@@ -43,6 +46,11 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
IKnockbackable,
|
IKnockbackable,
|
||||||
IForgeEntity
|
IForgeEntity
|
||||||
{
|
{
|
||||||
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
|
[Dependency]
|
||||||
|
public InventoryManager InventoryManager => this.DependOn<InventoryManager>();
|
||||||
|
|
||||||
// Enums
|
// Enums
|
||||||
public enum AllowedInputs
|
public enum AllowedInputs
|
||||||
{
|
{
|
||||||
@@ -426,7 +434,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
|
|
||||||
private AbilityHandle? _empoweredActionHandle;
|
private AbilityHandle? _empoweredActionHandle;
|
||||||
|
|
||||||
public override void _Ready()
|
public void OnReady()
|
||||||
{
|
{
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
@@ -716,15 +724,21 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_parryStandard.StateEntered += OnStandardParryStarted;
|
_parryStandard.StateEntered += OnStandardParryStarted;
|
||||||
_parryDash.StateEntered += OnDashParryStarted;
|
_parryDash.StateEntered += OnDashParryStarted;
|
||||||
|
|
||||||
// Inventory Management
|
|
||||||
InventoryManager.Instance.WeaponEventAbilityAdded += OnWeaponEventAbilityAdded;
|
|
||||||
InventoryManager.Instance.WeaponEventAbilityRemoved += OnWeaponEventAbilityRemoved;
|
|
||||||
|
|
||||||
// Forge events
|
// Forge events
|
||||||
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||||
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnResolved()
|
||||||
|
{
|
||||||
|
// All of my dependencies are now available! Do whatever you want with
|
||||||
|
// them here.
|
||||||
|
|
||||||
|
// Inventory Management
|
||||||
|
InventoryManager.WeaponEventAbilityAdded += OnWeaponEventAbilityAdded;
|
||||||
|
InventoryManager.WeaponEventAbilityRemoved += OnWeaponEventAbilityRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnWeaponLeft(EventData data)
|
public void OnWeaponLeft(EventData data)
|
||||||
{
|
{
|
||||||
var target = data.Target;
|
var target = data.Target;
|
||||||
@@ -1933,6 +1947,8 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Slam Management ///////
|
// Slam Management ///////
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
|
private Vector3 _slamStartPosition = Vector3.Zero;
|
||||||
public void OnInputSlamPressed()
|
public void OnInputSlamPressed()
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("slam");
|
_playerState.SendEvent("slam");
|
||||||
@@ -1940,6 +1956,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
|
|
||||||
public void SlamStarted()
|
public void SlamStarted()
|
||||||
{
|
{
|
||||||
|
_slamStartPosition = GlobalPosition;
|
||||||
SetHorizontalVelocity(Vector2.Zero);
|
SetHorizontalVelocity(Vector2.Zero);
|
||||||
SetVerticalVelocity(-SlamSpeed);
|
SetVerticalVelocity(-SlamSpeed);
|
||||||
_audioStream.SwitchToClipByName("dash");
|
_audioStream.SwitchToClipByName("dash");
|
||||||
@@ -1950,11 +1967,16 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
}
|
}
|
||||||
public void SlamEnded()
|
public void SlamEnded()
|
||||||
{
|
{
|
||||||
|
var distanceTraveled = GlobalPosition.DistanceTo(_slamStartPosition);
|
||||||
HeadSystem.OnGetHit();
|
HeadSystem.OnGetHit();
|
||||||
_audioStream.SwitchToClipByName("slam");
|
_audioStream.SwitchToClipByName("slam");
|
||||||
|
|
||||||
if (Explosion.Instantiate() is not Explosion explosion) return;
|
if (Explosion.Instantiate() is not Explosion explosion) return;
|
||||||
explosion.Radius = 10f;
|
|
||||||
|
// Basic distance traveled explosion manipulation
|
||||||
|
explosion.Radius = distanceTraveled;
|
||||||
|
explosion.RDamage.DamageDealt = distanceTraveled;
|
||||||
|
|
||||||
GetTree().GetRoot().AddChild(explosion);
|
GetTree().GetRoot().AddChild(explosion);
|
||||||
explosion.GlobalPosition = GlobalPosition;
|
explosion.GlobalPosition = GlobalPosition;
|
||||||
}
|
}
|
||||||
@@ -2310,13 +2332,13 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
// Manage gameplay systems
|
// Manage gameplay systems
|
||||||
MantleSystem.ProcessMantle(_grounded.Active);
|
MantleSystem.ProcessMantle(_grounded.Active);
|
||||||
HandleEnemyTargeting();
|
HandleEnemyTargeting();
|
||||||
|
// Manage head and camera movement
|
||||||
|
LookAround(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private float _oldMana = 100;
|
// private float _oldMana = 100;
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
// Manage head and camera movement
|
|
||||||
LookAround(delta);
|
|
||||||
EffectsManager.UpdateEffects(delta);
|
EffectsManager.UpdateEffects(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user