Zombie + Skeletton capacities
This commit is contained in:
parent
e94e2b8dce
commit
3fc57e3a64
12 changed files with 162 additions and 3 deletions
22
Assets/Scripts/UnitScripts/Capacities/ZombieSpeedBoost.cs
Normal file
22
Assets/Scripts/UnitScripts/Capacities/ZombieSpeedBoost.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class ZombieSpeedBoost : BaseCapacity
|
||||
{
|
||||
[SerializeField] float timeToBoost;
|
||||
[SerializeField] float boost;
|
||||
protected override bool CapacityCall()
|
||||
{
|
||||
MinecraftUnit minecraftUnit = _unit as MinecraftUnit;
|
||||
StartCoroutine(AddThenRemoveSpeed(minecraftUnit));
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerator AddThenRemoveSpeed(MinecraftUnit minecraftUnit)
|
||||
{
|
||||
// Possibility float imprecision issues
|
||||
minecraftUnit.MovementHandler.speed *= boost;
|
||||
yield return new WaitForSeconds(timeToBoost);
|
||||
minecraftUnit.MovementHandler.speed /= boost;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue