this idiot forgot to commit an entire month's worth of code
This commit is contained in:
parent
c67146ea1a
commit
a3321d361c
51 changed files with 3644 additions and 84 deletions
|
|
@ -13,6 +13,7 @@ public class Enemy : Entity
|
|||
public float currentCooldown;
|
||||
}
|
||||
public static event Action OnDamaged;
|
||||
public static event Action OnKill;
|
||||
[Header("Targetting")]
|
||||
public Entity closestTarget;
|
||||
public float engagementRange;
|
||||
|
|
@ -22,8 +23,8 @@ public class Enemy : Entity
|
|||
public Transform[] possibleDirections;
|
||||
public float forwardPercent;
|
||||
public float strafePercent;
|
||||
private float xSign = -1f;
|
||||
private float ySign = 1f;
|
||||
protected float xSign = -1f;
|
||||
protected float ySign = 1f;
|
||||
|
||||
[System.Serializable]
|
||||
public class UpgradeDrop
|
||||
|
|
@ -37,6 +38,11 @@ public class Enemy : Entity
|
|||
|
||||
[Header("Abilities")]
|
||||
[SerializeField] private Ability[] allAbilities;
|
||||
|
||||
[Header("Levels")]
|
||||
[SerializeField] private float levelHealthBuff;
|
||||
[SerializeField] private float levelPowerBuff;
|
||||
public float powerBuffAmount;
|
||||
private void Start()
|
||||
{
|
||||
if (Random.Range(0f, 2f) > 1f)
|
||||
|
|
@ -44,16 +50,21 @@ public class Enemy : Entity
|
|||
xSign = -xSign;
|
||||
ySign = -ySign;
|
||||
}
|
||||
//set hp and dmg values
|
||||
maxHealth = baseMaxHealth * (EnemySpawner.instance.enemyLevel * levelHealthBuff);
|
||||
health = maxHealth;
|
||||
powerBuffAmount = EnemySpawner.instance.enemyLevel * levelPowerBuff;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (detectedPlayer)
|
||||
{
|
||||
Ability foundAbility = null;
|
||||
foreach (Ability availableAbility in allAbilities)
|
||||
{
|
||||
if (foundAbility == null && availableAbility.currentCooldown <= 0 && availableAbility.ability.range < Vector3.Distance(closestTarget.transform.position, transform.position))
|
||||
float targetDistance = Vector3.Distance(closestTarget.transform.position, transform.position);
|
||||
if (foundAbility == null && availableAbility.currentCooldown <= 0 && availableAbility.ability.maxRange > targetDistance && availableAbility.ability.minRange < targetDistance)
|
||||
{
|
||||
foundAbility = availableAbility;
|
||||
}
|
||||
|
|
@ -100,7 +111,7 @@ public class Enemy : Entity
|
|||
directionToMove = directionToPoint;
|
||||
}
|
||||
}
|
||||
rb.VelocityTowards(directionToMove.ScaleToMagnitude(speed), acceleration);
|
||||
rb.VelocityTowards(directionToMove.ScaleToMagnitude(speed * speedMultiplier), acceleration);
|
||||
FlipSprite(directionToMove);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue