basic interface and no success trying to use them in a Tool script
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=50 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=51 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="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
|
||||
@@ -49,6 +49,8 @@ height = 1.7
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_6lejt"]
|
||||
radius = 0.45
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_q14ux"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nodcl"]
|
||||
transparency = 1
|
||||
albedo_color = Color(0, 0.627451, 0.6313726, 0.49019608)
|
||||
@@ -164,6 +166,17 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
||||
MantleEndLocationDistanceFromWall = 0.3
|
||||
MantleHeightCastStart = 2.5
|
||||
|
||||
[node name="WeaponHitbox" type="Area3D" parent="HeadSystem"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="HeadSystem/WeaponHitbox"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1)
|
||||
shape = SubResource("SphereShape3D_q14ux")
|
||||
|
||||
[node name="StairsSystem" type="Node3D" parent="."]
|
||||
script = ExtResource("7_bmt5a")
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
public ShapeCast3D GroundDetector;
|
||||
public ShapeCast3D CeilingDetector;
|
||||
public RayCast3D DirectGroundDetector;
|
||||
public Area3D WeaponHitbox;
|
||||
|
||||
// Inspector stuff
|
||||
[Export] public Marker3D TutorialWeaponTarget;
|
||||
@@ -353,6 +354,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
var playerShape = StandingCollider.GetShape() as CapsuleShape3D;
|
||||
_playerHeight = playerShape!.Height;
|
||||
_playerRadius = playerShape.Radius;
|
||||
|
||||
WeaponHitbox = GetNode<Area3D>("%WeaponHitbox");
|
||||
|
||||
// State management
|
||||
_playerState = StateChart.Of(GetNode("StateChart"));
|
||||
@@ -1572,10 +1575,20 @@ public partial class PlayerController : CharacterBody3D
|
||||
///////////////////////////
|
||||
public void OnInputHitPressed()
|
||||
{
|
||||
if (_aiming.Active)
|
||||
if (_aiming.Active && WeaponSystem.InHandState.Active)
|
||||
{
|
||||
ThrowWeapon();
|
||||
}
|
||||
|
||||
if (WeaponSystem.InHandState.Active)
|
||||
{
|
||||
var bodies = WeaponHitbox.GetOverlappingBodies();
|
||||
foreach (var body in bodies)
|
||||
{
|
||||
if(body is ISpawnable spawnable)
|
||||
spawnable.TestMethod();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user