Add debug menu, add ability to load next floor or spawn item
This commit is contained in:
@@ -87,7 +87,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
_lineOfSight.BodyEntered += LineOfSight_BodyEntered;
|
||||
}
|
||||
|
||||
public void OnProcess(double delta)
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (CurrentHP.Value <= 0)
|
||||
return;
|
||||
@@ -159,7 +159,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
_knockbackStrength = 0.3f;
|
||||
}
|
||||
|
||||
public void Die()
|
||||
public virtual void Die()
|
||||
{
|
||||
SetProcess(false);
|
||||
CurrentHP.OnNext(0);
|
||||
|
||||
@@ -9,4 +9,6 @@ public interface INavigationAgentClient
|
||||
public void SetTarget(Vector3 target);
|
||||
|
||||
public bool IsAvoidanceEnabled { get; }
|
||||
|
||||
public void Stop();
|
||||
}
|
||||
|
||||
@@ -22,39 +22,45 @@ public partial class NavigationAgentClient : Node3D, INavigationAgentClient
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
NavAgent.VelocityComputed += NavAgent_VelocityComputed;
|
||||
NavAgent.TargetReached += NavAgent_TargetReached;
|
||||
NavAgent.VelocityComputed += NavAgent_VelocityComputed;
|
||||
NavAgent.TargetReached += NavAgent_TargetReached;
|
||||
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.Timeout += OnPatrolTimeout;
|
||||
_patrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f);
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.Timeout += OnPatrolTimeout;
|
||||
_patrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f);
|
||||
|
||||
_thinkTimer = new Timer
|
||||
{
|
||||
WaitTime = 0.4f
|
||||
};
|
||||
AddChild(_thinkTimer);
|
||||
_thinkTimer.Timeout += NavAgent_TargetReached;
|
||||
_thinkTimer.Start();
|
||||
_thinkTimer = new Timer
|
||||
{
|
||||
WaitTime = 0.4f
|
||||
};
|
||||
AddChild(_thinkTimer);
|
||||
_thinkTimer.Timeout += NavAgent_TargetReached;
|
||||
_thinkTimer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_patrolTimer.Stop();
|
||||
_thinkTimer.Stop();
|
||||
}
|
||||
|
||||
private void NavAgent_VelocityComputed(Vector3 safeVelocity)
|
||||
{
|
||||
if (!_canMove)
|
||||
return;
|
||||
if (!_canMove)
|
||||
return;
|
||||
|
||||
var enemy = GetOwner() as IEnemy;
|
||||
enemy.Move(safeVelocity);
|
||||
var enemy = GetOwner() as IEnemy;
|
||||
enemy.Move(safeVelocity);
|
||||
}
|
||||
|
||||
public void CalculateVelocity(Vector3 currentPosition, bool canMove)
|
||||
{
|
||||
_canMove = canMove;
|
||||
var nextPathPosition = NavAgent.GetNextPathPosition();
|
||||
_canMove = canMove;
|
||||
var nextPathPosition = NavAgent.GetNextPathPosition();
|
||||
|
||||
var newVelocity = currentPosition.DirectionTo(nextPathPosition) * 2f;
|
||||
NavAgent.Velocity = newVelocity;
|
||||
var newVelocity = currentPosition.DirectionTo(nextPathPosition) * 2f;
|
||||
NavAgent.Velocity = newVelocity;
|
||||
}
|
||||
public void SetTarget(Vector3 target) => Task.Delay(TimeSpan.FromSeconds(0.4)).ContinueWith(_ => _currentTarget = new Vector3(target.X, -1.75f, target.Z));
|
||||
|
||||
@@ -63,15 +69,15 @@ public partial class NavigationAgentClient : Node3D, INavigationAgentClient
|
||||
|
||||
private void NavAgent_TargetReached()
|
||||
{
|
||||
NavAgent.TargetPosition = _currentTarget;
|
||||
NavAgent.TargetPosition = _currentTarget;
|
||||
}
|
||||
|
||||
private void OnPatrolTimeout()
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.WaitTime = rng.RandfRange(5.0f, 10.0f);
|
||||
var enemy = GetOwner() as ICanPatrol;
|
||||
enemy.Patrol();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.WaitTime = rng.RandfRange(5.0f, 10.0f);
|
||||
var enemy = GetOwner() as ICanPatrol;
|
||||
enemy.Patrol();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ public partial class Sproingy : Enemy, IHasPrimaryAttack, ICanPatrol
|
||||
PrimaryAttack();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class Michael : Enemy, IHasPrimaryAttack, ICanPatrol
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public new void OnPhysicsProcess(double delta)
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
|
||||
@@ -38,6 +38,12 @@ public partial class Michael : Enemy, IHasPrimaryAttack, ICanPatrol
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public override void TakeAction()
|
||||
{
|
||||
PrimaryAttack();
|
||||
|
||||
@@ -57,6 +57,12 @@ public partial class Sara : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICanP
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -30,7 +30,7 @@ public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICa
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public new void OnPhysicsProcess(double delta)
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
|
||||
@@ -53,6 +53,13 @@ public partial class Ballos : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICa
|
||||
var selection = rng.RandWeighted([0.875f, 0.125f]);
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -80,6 +80,7 @@ shape = SubResource("SphereShape3D_lqifn")
|
||||
|
||||
[node name="EnemyModelView" parent="." instance=ExtResource("3_q1q0f")]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.999848, 0, 0.0174524, 0, 1, 0, -0.0174524, 0, 0.999848, 0, 0, 0)
|
||||
|
||||
[node name="Raycast" type="RayCast3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -6952,7 +6952,7 @@ script = ExtResource("1_ol7va")
|
||||
EnemyLoreInfo = SubResource("Resource_500at")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 2, 0)
|
||||
transform = Transform3D(-1.5, 0, -1.31134e-07, 0, 1.5, 0, 1.31134e-07, 0, -1.5, 0, 0, 0)
|
||||
billboard = 2
|
||||
alpha_cut = 1
|
||||
texture_filter = 0
|
||||
|
||||
@@ -28,7 +28,7 @@ public partial class Chinthe : Enemy, IHasPrimaryAttack, ICanPatrol, ICanActivat
|
||||
EnemyModelView.Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public new void OnPhysicsProcess(double delta)
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
|
||||
@@ -47,6 +47,12 @@ public partial class Chinthe : Enemy, IHasPrimaryAttack, ICanPatrol, ICanActivat
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public override void TakeAction()
|
||||
{
|
||||
PrimaryAttack();
|
||||
|
||||
@@ -57,6 +57,12 @@ public partial class Ambassador : Enemy, IHasPrimaryAttack, IHasSecondaryAttack,
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -53,6 +53,13 @@ public partial class AgiDemon : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, I
|
||||
var selection = rng.RandWeighted([0.875f, 0.125f]);
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -53,6 +53,13 @@ public partial class Palan : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICan
|
||||
var selection = rng.RandWeighted([0.875f, 0.125f]);
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -53,6 +53,13 @@ public partial class ShieldOfHeaven : Enemy, IHasPrimaryAttack, IHasSecondaryAtt
|
||||
var selection = rng.RandWeighted([0.875f, 0.125f]);
|
||||
options[(int)selection].Invoke();
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
script = ExtResource("2_bpd8u")
|
||||
CurrentHP = 100.0
|
||||
MaximumHP = 100
|
||||
CurrentAttack = 0
|
||||
CurrentDefense = 0
|
||||
MaxAttack = 0
|
||||
MaxDefense = 0
|
||||
ExpFromDefeat = 0
|
||||
CurrentAttack = null
|
||||
CurrentDefense = null
|
||||
MaxAttack = null
|
||||
MaxDefense = null
|
||||
ExpFromDefeat = null
|
||||
Luck = 0.05
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
_telluricResistance = null
|
||||
_aeolicResistance = null
|
||||
_hydricResistance = null
|
||||
_igneousResistance = null
|
||||
_ferrumResistance = null
|
||||
DropsSoulGemChance = 0.0
|
||||
metadata/_custom_type_script = "uid://dnkmr0eq1sij0"
|
||||
|
||||
@@ -33,6 +33,7 @@ collision_layer = 2
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_dqcrh")
|
||||
_enemyStatResource = SubResource("Resource_ccv8a")
|
||||
_maximumWallMoveAmount = null
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.40558, 8.3319, 2.53654)
|
||||
|
||||
@@ -157,33 +157,57 @@ unique_name_in_owner = true
|
||||
|
||||
[node name="Arm1" parent="LeftArms" instance=ExtResource("1_ell80")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm2" parent="LeftArms" instance=ExtResource("2_kblru")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm3" parent="LeftArms" instance=ExtResource("3_nqxqr")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm4" parent="LeftArms" instance=ExtResource("4_r5yku")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm5" parent="LeftArms" instance=ExtResource("5_5oa7x")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="RightArms" type="Node3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Arm6" parent="RightArms" instance=ExtResource("6_h1yna")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm7" parent="RightArms" instance=ExtResource("7_6s6sq")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm8" parent="RightArms" instance=ExtResource("8_e82oe")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Arm9" parent="RightArms" instance=ExtResource("9_c826n")]
|
||||
unique_name_in_owner = true
|
||||
Damage = null
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="Base" type="Node3D" parent="."]
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ CurrentAttack = 10
|
||||
CurrentDefense = 5
|
||||
MaxAttack = 10
|
||||
MaxDefense = 5
|
||||
ExpFromDefeat = 0
|
||||
ExpFromDefeat = null
|
||||
Luck = 0.05
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_telluricResistance = null
|
||||
_aeolicResistance = null
|
||||
_hydricResistance = 0.5
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
DropsSoulGemChance = 0.75
|
||||
_igneousResistance = null
|
||||
_ferrumResistance = null
|
||||
DropsSoulGemChance = null
|
||||
metadata/_custom_type_script = "uid://dnkmr0eq1sij0"
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
|
||||
@@ -41,8 +41,11 @@ axis_lock_linear_y = true
|
||||
axis_lock_angular_x = true
|
||||
script = ExtResource("1_wbopj")
|
||||
PrimaryAttackElementalType = 3
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
SecondaryAttackElementalType = 3
|
||||
SecondaryAttackElementalDamageBonus = null
|
||||
_enemyStatResource = SubResource("Resource_m7ocm")
|
||||
_movementSpeed = null
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State {
|
||||
state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive {
|
||||
state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated {
|
||||
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
|
||||
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
|
||||
state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking
|
||||
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
|
||||
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
|
||||
}
|
||||
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user