} //Awake private new void Update() { base.Update(); //Check if the thief is still alive if (!IsAlive()) return; // Getting the distance between the player and itself var distance = Vector2.Distance(transform.position, player.transform.position); if (distance < chasingRadius) currentTarget = player; if (distance < freezeRadius && !isCasting) GetAbility("Freeze").StartAbility(this); else if (distance < iceRadius && !isCasting) GetAbility("Ice").StartAbility(this); if (distance < spikeRadius) if (GetAbility("Spikes").StartAbility(this)) { // If the ability is started, point the spikes at the player Vector2 dir = player.transform.position - transform.position; spikeDetector.SetDirection(dir); } } //Update
// Throws the projectile in a direction public void Throw(Vector2 throwPosition) { var t = transform; t.up = throwPosition - (Vector2)t.position; areaChecker.SetDirection(t.up); deathTimer = deathResetTime; }