Improved Watcher, added a defeat sound
This commit is contained in:
parent
d1536529e4
commit
207c90a68b
5 changed files with 38 additions and 5 deletions
|
@ -52,10 +52,12 @@ public partial class Watcher : Node2D
|
|||
case State.LitUp:
|
||||
_isLitUp = false;
|
||||
|
||||
((AudioStreamPlayer2D)FindChild("SighPlayer2D")).Play();
|
||||
|
||||
var newPosition = (_player.Position - Position).Normalized();
|
||||
if (newPosition.IsZeroApprox())
|
||||
newPosition = new Vector2(0, -1);
|
||||
Position += newPosition * Constants.HalfScreenSize.Length();
|
||||
Position = _player.Position + newPosition * Constants.HalfScreenSize * 1.5f; // TODO: magic number
|
||||
|
||||
HideEye();
|
||||
break;
|
||||
|
@ -166,9 +168,6 @@ public partial class Watcher : Node2D
|
|||
|
||||
private void LightEntered(Area2D area)
|
||||
{
|
||||
if (CurrentState is State.Waiting or State.Opening or State.Teleporting or State.LitUp)
|
||||
return;
|
||||
|
||||
if (area.GetParentOrNull<GameCamera>() is null)
|
||||
return; // Not a flashlight
|
||||
|
||||
|
@ -176,6 +175,15 @@ public partial class Watcher : Node2D
|
|||
GD.Print("watcher: light enter");
|
||||
}
|
||||
|
||||
private void LightExited(Area2D area)
|
||||
{
|
||||
if (area.GetParentOrNull<GameCamera>() is null)
|
||||
return; // Not a flashlight
|
||||
|
||||
_isLitUp = false;
|
||||
GD.Print("watcher: light exit");
|
||||
}
|
||||
|
||||
private void PlayerEntered(Node2D body)
|
||||
{
|
||||
if (body is not Player player)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue