Добавлен босс
This commit is contained in:
parent
b01a092fdb
commit
66558fb1e3
12 changed files with 360 additions and 9 deletions
|
@ -161,10 +161,14 @@ public partial class LivingArmor : CharacterBody2D
|
|||
foreach (var body in _bodiesInSight)
|
||||
{
|
||||
var distance = (body.Position - Position).Length();
|
||||
GD.Print($"{body.Name}");
|
||||
switch (body)
|
||||
{
|
||||
case Boss boss:
|
||||
_target = boss;
|
||||
break;
|
||||
case Wretched wretched:
|
||||
if (_target is Boss)
|
||||
continue;
|
||||
if (targetDistance < 0 || targetDistance > distance)
|
||||
{
|
||||
targetDistance = distance;
|
||||
|
@ -172,12 +176,8 @@ public partial class LivingArmor : CharacterBody2D
|
|||
}
|
||||
break;
|
||||
case Player player:
|
||||
|
||||
if (_target is Wretched)
|
||||
{
|
||||
if (_target is Wretched or Boss)
|
||||
continue;
|
||||
}
|
||||
|
||||
_target = player;
|
||||
break;
|
||||
}
|
||||
|
@ -227,16 +227,16 @@ public partial class LivingArmor : CharacterBody2D
|
|||
|
||||
private void _OnBodyEntered(Node2D body)
|
||||
{
|
||||
if (body is not Wretched and not Player)
|
||||
if (body is not Wretched and not Player and not Boss)
|
||||
return;
|
||||
|
||||
GD.Print($"{body.Name} Entered");
|
||||
_bodiesInSight.Add(body);
|
||||
}
|
||||
|
||||
|
||||
private void _OnBodyExited(Node2D body)
|
||||
{
|
||||
if (body is not Wretched and not Player)
|
||||
if (body is not Wretched and not Player and not Boss)
|
||||
return;
|
||||
if (body == _target)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue