basic interface and no success trying to use them in a Tool script
This commit is contained in:
@@ -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