Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
e4880d42f9 | |||
ef16d6c83f | |||
85eab200ea |
@ -47,7 +47,7 @@ jobs:
|
||||
run: |
|
||||
apt update && apt -y install curl zip nodejs
|
||||
- name: Checkout with LFS
|
||||
uses: https://git.game-dev.space/minimata/checkout-lfs.git@main
|
||||
uses: https://git.game-dev.space/minimata/checkout-with-lfs.git@main
|
||||
with:
|
||||
checkout-version: 3
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=36 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=38 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||
@ -34,6 +34,8 @@
|
||||
[ext_resource type="Script" uid="uid://tjiji63wlom5" path="res://systems/wall_hug/WallHugSystem.cs" id="27_n7qhm"]
|
||||
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="28_n7qhm"]
|
||||
[ext_resource type="PackedScene" uid="uid://ckm3d6k08a72u" path="res://systems/weapon/weapon.tscn" id="29_wv70j"]
|
||||
[ext_resource type="Script" uid="uid://bhuwv2nlcrunt" path="res://player_controller/PlayerUi.cs" id="30_2ghaa"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnwj7ltdfximr" path="res://icon.svg" id="30_h23go"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||
height = 1.7
|
||||
@ -42,7 +44,7 @@ height = 1.7
|
||||
script = ExtResource("1_poq2x")
|
||||
TimeScaleAimInAir = 0.15
|
||||
MaxJumpBoostAfterDashing = 0.7
|
||||
MaxNumberOfDashActions = 3
|
||||
MaxNumberOfDashActions = 2
|
||||
|
||||
[node name="InputController" type="Node3D" parent="."]
|
||||
script = ExtResource("16_v31n3")
|
||||
@ -181,12 +183,43 @@ wait_time = 0.3
|
||||
one_shot = true
|
||||
|
||||
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
|
||||
offset_left = 1530.0
|
||||
offset_left = 1524.0
|
||||
offset_top = 1.0
|
||||
offset_right = -2.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = 1.0
|
||||
enabled = false
|
||||
initial_node_to_watch = NodePath("../StateChart")
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
script = ExtResource("30_2ghaa")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="UI"]
|
||||
offset_right = 128.0
|
||||
offset_bottom = 81.0
|
||||
|
||||
[node name="DashesLabel" type="Label" parent="UI/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Dashes"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="UI/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Dash1" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("30_h23go")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="Dash2" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("30_h23go")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="Dash3" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("30_h23go")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="StateChart" type="Node" parent="."]
|
||||
script = ExtResource("25_wv70j")
|
||||
metadata/_custom_type_script = "uid://couw105c3bde4"
|
||||
@ -320,29 +353,29 @@ delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnCrouch" type="Node" parent="StateChart/Root/Movement/Grounded/Standing"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Crouch")
|
||||
to = NodePath("../../Crouched")
|
||||
event = &"crouch"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Crouch" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||
[node name="Crouched" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/Jump")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
||||
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/CoyoteEnabled")
|
||||
event = &"start_falling"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnStandUp" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
||||
[node name="OnStandUp" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Standing")
|
||||
event = &"stand_up"
|
||||
event = &"crouch"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Mantling" type="Node" parent="StateChart/Root/Movement"]
|
||||
|
26
player_controller/PlayerUi.cs
Normal file
26
player_controller/PlayerUi.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PlayerUi : CanvasLayer
|
||||
{
|
||||
private TextureRect[] _dashIcons = new TextureRect[3];
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_dashIcons[0] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash1");
|
||||
_dashIcons[1] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash2");
|
||||
_dashIcons[2] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash3");
|
||||
}
|
||||
|
||||
public void SetNumberOfDashesLeft(int numberOfDashes)
|
||||
{
|
||||
int index = 1;
|
||||
foreach (var dashIcon in _dashIcons)
|
||||
{
|
||||
dashIcon.SetVisible(index <= numberOfDashes);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
1
player_controller/PlayerUi.cs.uid
Normal file
1
player_controller/PlayerUi.cs.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://bhuwv2nlcrunt
|
@ -23,6 +23,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
public Node3D WeaponRoot;
|
||||
public WeaponSystem WeaponSystem;
|
||||
public WallHugSystem WallHugSystem;
|
||||
public PlayerUi PlayerUi;
|
||||
|
||||
private bool _movementEnabled = true;
|
||||
|
||||
@ -52,9 +53,18 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
[Export(PropertyHint.Range, "0,5,1,or_greater")]
|
||||
public int MaxNumberOfDashActions { get; set; } = 1;
|
||||
|
||||
public int DashActionsLeft { get; set; }
|
||||
|
||||
private int _dashActionsLeft;
|
||||
public int DashActionsLeft
|
||||
{
|
||||
get => _dashActionsLeft;
|
||||
set
|
||||
{
|
||||
_dashActionsLeft = value;
|
||||
PlayerUi.SetNumberOfDashesLeft(value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isWallJumpAvailable = true;
|
||||
|
||||
private StateChart _playerState;
|
||||
@ -66,6 +76,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
private StateChartState _actionHanging;
|
||||
// Movement state
|
||||
private StateChartState _grounded;
|
||||
private StateChartState _crouched;
|
||||
private StateChartState _standing;
|
||||
private StateChartState _mantling;
|
||||
private StateChartState _movHanging;
|
||||
private StateChartState _wallHugging;
|
||||
@ -85,6 +97,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
// General use stuff
|
||||
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
|
||||
PlayerUi = GetNode<PlayerUi>("UI");
|
||||
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
|
||||
|
||||
// Camera stuff
|
||||
@ -132,6 +145,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
_actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
// Movement states
|
||||
_grounded = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded"));
|
||||
_standing = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Standing"));
|
||||
_crouched = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Crouched"));
|
||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/Hanging"));
|
||||
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
||||
@ -200,6 +215,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
_aiming.StateEntered += OnAimingEntered;
|
||||
_aiming.StateExited += ResetTimeScale;
|
||||
|
||||
/*_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
|
||||
_standing.StatePhysicsProcessing += HandleGroundedStanding;*/
|
||||
_grounded.StateEntered += OnGrounded;
|
||||
_grounded.StatePhysicsProcessing += HandleGrounded;
|
||||
_airborne.StatePhysicsProcessing += HandleAirborne;
|
||||
@ -287,7 +304,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public void PerformDashAction()
|
||||
{
|
||||
_isWallJumpAvailable = true;
|
||||
_isWallJumpAvailable = true;
|
||||
_dashCooldownTimer.Start();
|
||||
DashActionsLeft--;
|
||||
}
|
||||
@ -495,6 +512,16 @@ public partial class PlayerController : CharacterBody3D
|
||||
if (!isOnFloorCustom())
|
||||
_playerState.SendEvent("start_falling");
|
||||
}
|
||||
public void HandleGroundedStanding(float delta)
|
||||
{
|
||||
CapsuleCollider.UndoCrouching(delta, 1);
|
||||
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||
}
|
||||
public void HandleGroundedCrouched(float delta)
|
||||
{
|
||||
CapsuleCollider.Crouch(delta, 1);
|
||||
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||
}
|
||||
public void HandleAirborne(float delta)
|
||||
{
|
||||
if (isOnFloorCustom())
|
||||
|
@ -29,7 +29,7 @@ ProjectUISoundController="*res://addons/maaacks_game_template/base/scenes/autolo
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1980
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1080
|
||||
|
||||
[dotnet]
|
||||
|
@ -34,4 +34,9 @@ public partial class HeadSystem : Node3D
|
||||
{
|
||||
return GetGlobalTransform().Basis.Z;
|
||||
}
|
||||
|
||||
public void SetHeight(float height)
|
||||
{
|
||||
Position = new Vector3(Position.X, height, Position.Z);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user