We got fast fuckers now

This commit is contained in:
2024-10-27 20:43:41 -07:00
parent 773a30a6b9
commit 49937d80b5
7 changed files with 246 additions and 8 deletions

View File

@@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
public class FastFucker : Ratbot
{
bool attack = true;
void Update() {
if (attack)
MoveTowardsPlayer(moveSpeed*3);
else
MoveAwayFromPlayer(moveSpeed);
}
void MoveAwayFromPlayer(float speed) {
controller.AddRelativeForce(
(transform.position - player.transform.position)
.normalized
*speed
*Time.deltaTime
);
}
new void OnCollisionStay2D (Collision2D collision) {
base.OnCollisionStay2D(collision);
StartCoroutine("RunAway");
}
IEnumerator RunAway() {
attack = false;
yield return new WaitForSeconds (1F);
attack = true;
}
}