Ballos fixes
This commit is contained in:
@@ -4,11 +4,12 @@ using Godot;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
using Zennysoft.Ma.Adapter;
|
using Zennysoft.Ma.Adapter;
|
||||||
|
using Zennysoft.Game.Abstractions;
|
||||||
|
|
||||||
namespace Zennysoft.Game.Ma;
|
namespace Zennysoft.Game.Ma;
|
||||||
|
|
||||||
[Meta(typeof(IAutoNode))]
|
[Meta(typeof(IAutoNode))]
|
||||||
public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack
|
public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICanPatrol
|
||||||
{
|
{
|
||||||
public override void _Notification(int what) => this.Notify(what);
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
@@ -21,6 +22,8 @@ public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack
|
|||||||
[Export]
|
[Export]
|
||||||
public double SecondaryAttackElementalDamageBonus { get; set; } = 1.0;
|
public double SecondaryAttackElementalDamageBonus { get; set; } = 1.0;
|
||||||
|
|
||||||
|
[Node] private INavigationAgentClient _navigationAgentClient { get; set; } = default!;
|
||||||
|
|
||||||
public void OnReady()
|
public void OnReady()
|
||||||
{
|
{
|
||||||
SetPhysicsProcess(true);
|
SetPhysicsProcess(true);
|
||||||
@@ -37,6 +40,10 @@ public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack
|
|||||||
_enemyLogic.Input(new EnemyLogic.Input.LostPlayer());
|
_enemyLogic.Input(new EnemyLogic.Input.LostPlayer());
|
||||||
if (_enemyLogic.Value is EnemyLogic.State.Attacking && GlobalPosition.DistanceTo(_player.CurrentPosition) > 2.5f)
|
if (_enemyLogic.Value is EnemyLogic.State.Attacking && GlobalPosition.DistanceTo(_player.CurrentPosition) > 2.5f)
|
||||||
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
||||||
|
|
||||||
|
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||||
|
|
||||||
|
base._PhysicsProcess(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void TakeAction()
|
public override void TakeAction()
|
||||||
@@ -56,6 +63,17 @@ public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack
|
|||||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||||
|
|
||||||
|
public void Patrol()
|
||||||
|
{
|
||||||
|
var rng = new RandomNumberGenerator();
|
||||||
|
rng.Randomize();
|
||||||
|
var randomizedSpot = new Vector3(rng.RandfRange(-5.0f, 5.0f), 0, rng.RandfRange(-5.0f, 5.0f));
|
||||||
|
_enemyLogic.Input(new EnemyLogic.Input.PatrolToRandomSpot(GlobalPosition + randomizedSpot));
|
||||||
|
_enemyLogic.Input(new EnemyLogic.Input.StartPatrol());
|
||||||
|
}
|
||||||
|
|
||||||
private void Hitbox_AreaEntered(Area3D area)
|
private void Hitbox_AreaEntered(Area3D area)
|
||||||
{
|
{
|
||||||
var target = area.GetOwner();
|
var target = area.GetOwner();
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://feegakykn3fv"]
|
[gd_scene load_steps=9 format=3 uid="uid://feegakykn3fv"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dwfxs5yrf7i3v" path="res://src/enemy/enemy_types/05. ballos/Ballos.cs" id="1_v2urn"]
|
[ext_resource type="Script" uid="uid://dwfxs5yrf7i3v" path="res://src/enemy/enemy_types/05. ballos/Ballos.cs" id="1_v2urn"]
|
||||||
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_iy2fp"]
|
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_iy2fp"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c5xijwxkg4pf6" path="res://src/enemy/enemy_types/05. ballos/BallosModelView.tscn" id="2_v2urn"]
|
[ext_resource type="PackedScene" uid="uid://c5xijwxkg4pf6" path="res://src/enemy/enemy_types/05. ballos/BallosModelView.tscn" id="2_v2urn"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://pbnsngx5jvrh" path="res://src/enemy/NavigationAgentClient.tscn" id="4_ko6aj"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_ko6aj"]
|
[sub_resource type="Resource" id="Resource_ko6aj"]
|
||||||
script = ExtResource("2_iy2fp")
|
script = ExtResource("2_iy2fp")
|
||||||
@@ -40,21 +41,18 @@ collision_mask = 11
|
|||||||
axis_lock_linear_y = true
|
axis_lock_linear_y = true
|
||||||
axis_lock_angular_x = true
|
axis_lock_angular_x = true
|
||||||
script = ExtResource("1_v2urn")
|
script = ExtResource("1_v2urn")
|
||||||
|
PrimaryAttackElementalType = null
|
||||||
|
PrimaryAttackElementalDamageBonus = null
|
||||||
|
SecondaryAttackElementalType = null
|
||||||
|
SecondaryAttackElementalDamageBonus = null
|
||||||
_enemyStatResource = SubResource("Resource_ko6aj")
|
_enemyStatResource = SubResource("Resource_ko6aj")
|
||||||
|
_movementSpeed = null
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
[node name="CollisionShape" type="CollisionShape3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||||
shape = SubResource("CapsuleShape3D_cwfph")
|
shape = SubResource("CapsuleShape3D_cwfph")
|
||||||
|
|
||||||
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
path_max_distance = 3.01
|
|
||||||
simplify_path = true
|
|
||||||
avoidance_enabled = true
|
|
||||||
radius = 2.0
|
|
||||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="LineOfSight" type="Area3D" parent="."]
|
[node name="LineOfSight" type="Area3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||||
@@ -89,3 +87,8 @@ shape = SubResource("SphereShape3D_8vcnq")
|
|||||||
|
|
||||||
[node name="EnemyModelView" parent="." instance=ExtResource("2_v2urn")]
|
[node name="EnemyModelView" parent="." instance=ExtResource("2_v2urn")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="Navigation" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
[node name="NavigationAgentClient" parent="Navigation" instance=ExtResource("4_ko6aj")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user