2.5d test
This commit is contained in:
@@ -18,6 +18,8 @@ namespace BumpCombat.Defense
|
||||
private float postAttackProgressRemaining;
|
||||
private bool wasAttackSequenceInProgress;
|
||||
private bool configured;
|
||||
private bool stationaryTowerTestDummy;
|
||||
private Vector2 stationaryTowerTestDummyAnchor;
|
||||
private int waypointIndex;
|
||||
|
||||
public EnemyController Enemy => enemy;
|
||||
@@ -60,8 +62,44 @@ namespace BumpCombat.Defense
|
||||
}
|
||||
}
|
||||
|
||||
public void ConfigureTowerTestDummy(EnemyController configuredEnemy, DefenseTowerKind immuneTowerKind)
|
||||
{
|
||||
enemy = configuredEnemy;
|
||||
Lane = -1;
|
||||
waypoints = Array.Empty<Vector2>();
|
||||
routeSpeed = 0f;
|
||||
playerEngagementRange = 0f;
|
||||
postAttackProgressSeconds = 0f;
|
||||
ImmuneTowerKind = immuneTowerKind;
|
||||
arrivalHandler = null;
|
||||
waypointIndex = 0;
|
||||
configured = enemy != null;
|
||||
stationaryTowerTestDummy = configured;
|
||||
stationaryTowerTestDummyAnchor = configuredEnemy != null
|
||||
? configuredEnemy.transform.position : Vector2.zero;
|
||||
HasArrived = false;
|
||||
player = FindAnyObjectByType<BumpCombat.Player.PlayerController>()?.transform;
|
||||
playerHealth = player != null ? player.GetComponent<BumpCombat.Player.PlayerHealth>() : null;
|
||||
}
|
||||
|
||||
public bool TryDriveFixedUpdate(float deltaTime)
|
||||
{
|
||||
if (stationaryTowerTestDummy)
|
||||
{
|
||||
if (enemy == null || enemy.IsDead)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (enemy.State == EnemyState.Spawn)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
enemy.SetDefenseCombatTarget(null);
|
||||
enemy.TryReposition(stationaryTowerTestDummyAnchor);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!configured || HasArrived || enemy == null || enemy.IsDead)
|
||||
{
|
||||
return false;
|
||||
@@ -90,6 +128,17 @@ namespace BumpCombat.Defense
|
||||
return false;
|
||||
}
|
||||
|
||||
DefensePrototypeController defense = DefensePrototypeController.Instance;
|
||||
DefenseSummonUnit summonTarget = defense != null
|
||||
? defense.FindNearestSummonTarget(transform.position,
|
||||
Mathf.Max(playerEngagementRange, defense.Tuning.SummonAreaRadius))
|
||||
: null;
|
||||
enemy.SetDefenseCombatTarget(summonTarget);
|
||||
if (summonTarget != null)
|
||||
{
|
||||
enemy.Alert();
|
||||
return false;
|
||||
}
|
||||
postAttackProgressRemaining = Mathf.Max(
|
||||
0f,
|
||||
postAttackProgressRemaining - Mathf.Max(0f, deltaTime));
|
||||
|
||||
Reference in New Issue
Block a user