mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Patterns tweaks
This commit is contained in:
parent
4be64cf7ec
commit
a430554e27
7 changed files with 69 additions and 22 deletions
|
|
@ -21,6 +21,11 @@ public partial class Boss : Enemy, IActivable
|
|||
public Vector2 HomePosition => _homePosition;
|
||||
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
|
||||
|
||||
private Marker2D _cameraMarker;
|
||||
|
||||
[Export]
|
||||
public Vector2 CameraOffset = Vector2.Zero;
|
||||
|
||||
// [Export]
|
||||
// private PackedScene _bossPhaseAnimationPrefab;
|
||||
|
||||
|
|
@ -37,12 +42,17 @@ public partial class Boss : Enemy, IActivable
|
|||
_gameManager = this.GetGameManager();
|
||||
|
||||
_homePosition = this.GlobalPosition;
|
||||
|
||||
_cameraMarker = new Marker2D();
|
||||
_gameManager.CallDeferred("add_child", _cameraMarker);
|
||||
_cameraMarker.GlobalPosition = _homePosition + CameraOffset;
|
||||
|
||||
if (BossHudPrefab is not null)
|
||||
{
|
||||
_bossHud = BossHudPrefab.Instantiate<BossHud>();
|
||||
_gameManager.CallDeferred("add_child", _bossHud);
|
||||
|
||||
|
||||
_bossHud.Visible = false;
|
||||
_bossHud.BossName = BossName;
|
||||
_bossHud.BossMaxHealth = this.Health;
|
||||
_bossHud.BossHealth = this._currentHealth;
|
||||
|
|
@ -117,6 +127,11 @@ public partial class Boss : Enemy, IActivable
|
|||
public void Activate(ActivationType activationType = ActivationType.Toggle)
|
||||
{
|
||||
_started = true;
|
||||
if (_bossHud is not null)
|
||||
{
|
||||
_bossHud.Visible = true;
|
||||
}
|
||||
_gameManager.CameraTargetObject(_cameraMarker);
|
||||
StartPhase(CurrentPhase);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,11 +112,26 @@ public partial class GameManager : Node2D
|
|||
|
||||
_player.GlobalPosition = PlayerSpawnMarker.Position;
|
||||
|
||||
if (_cameraTarget != null)
|
||||
{
|
||||
_cameraTarget.Reparent(_player, true);
|
||||
_cameraTarget.GlobalPosition = _player.Position;
|
||||
}
|
||||
CameraTargetPlayer();
|
||||
//
|
||||
// if (_cameraTarget != null)
|
||||
// {
|
||||
// _cameraTarget.Reparent(_player, true);
|
||||
// _cameraTarget.GlobalPosition = _player.Position;
|
||||
// }
|
||||
}
|
||||
|
||||
public void CameraTargetPlayer()
|
||||
{
|
||||
if (_player is null) return;
|
||||
CameraTargetObject(_player);
|
||||
}
|
||||
|
||||
public void CameraTargetObject(Node2D target)
|
||||
{
|
||||
if (_cameraTarget is null) return;
|
||||
_cameraTarget.Reparent(target, true);
|
||||
_cameraTarget.GlobalPosition = target.GlobalPosition;
|
||||
}
|
||||
|
||||
private void SpawnWeapons()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public partial class SimpleMovementPattern : AttackPattern
|
|||
|
||||
Vector2 targetPosition = (Boss?.HomePosition ?? boss.GlobalPosition) + relativeTargetPosition;
|
||||
|
||||
tween.TweenProperty(Boss, "position", targetPosition, moveDuration)
|
||||
tween.TweenProperty(Boss, "global_position", targetPosition, moveDuration)
|
||||
.SetTrans(transitionType)
|
||||
.SetEase(easeType)
|
||||
.Finished += () => isComplete = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue