two enemy types, ready to refactor
This commit is contained in:
@@ -50,6 +50,7 @@ height = 1.7
|
||||
radius = 0.45
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_q14ux"]
|
||||
radius = 1.0
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nodcl"]
|
||||
transparency = 1
|
||||
@@ -174,7 +175,7 @@ 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)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5)
|
||||
shape = SubResource("SphereShape3D_q14ux")
|
||||
|
||||
[node name="StairsSystem" type="Node3D" parent="."]
|
||||
|
||||
@@ -2,11 +2,12 @@ using System;
|
||||
using Godot;
|
||||
using GodotStateCharts;
|
||||
using Movementtests.addons.godot_state_charts.csharp;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.systems;
|
||||
using Movementtests.player_controller.Scripts;
|
||||
using RustyOptions;
|
||||
|
||||
public partial class PlayerController : CharacterBody3D
|
||||
public partial class PlayerController : CharacterBody3D, IDamageable, IKnockbackable
|
||||
{
|
||||
// Enums
|
||||
public enum AllowedInputs
|
||||
@@ -1580,14 +1581,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
ThrowWeapon();
|
||||
}
|
||||
|
||||
if (WeaponSystem.InHandState.Active)
|
||||
if (!WeaponSystem.InHandState.Active) return;
|
||||
|
||||
var bodies = WeaponHitbox.GetOverlappingBodies();
|
||||
foreach (var body in bodies)
|
||||
{
|
||||
var bodies = WeaponHitbox.GetOverlappingBodies();
|
||||
foreach (var body in bodies)
|
||||
{
|
||||
if(body is ISpawnable spawnable)
|
||||
spawnable.TestMethod();
|
||||
}
|
||||
if(body is IDamageable spawnable)
|
||||
spawnable.TakeDamage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1741,4 +1741,9 @@ public partial class PlayerController : CharacterBody3D
|
||||
DashIndicatorNode.LookAt(WeaponSystem.GlobalPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public void TakeDamage()
|
||||
{
|
||||
GD.Print("Ouch!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user