I'M DONE. THE DEADLINE HAS BEEN HIT. GOODNIGHT

This commit is contained in:
Gregory Campbell
2020-07-12 15:18:16 -04:00
parent 4e53e69050
commit fb302195ed
140 changed files with 4386 additions and 17 deletions
+13
View File
@@ -10,11 +10,16 @@ public class EnemyScript : MonoBehaviour
private float speed;
private GameObject player;
private Vector2 movement;
private Rigidbody2D rb;
private Animator animator;
private AudioSource audioSource;
void Start()
{
rb = GetComponent<Rigidbody2D>();
animator = GetComponent<Animator>();
audioSource = GetComponent<AudioSource>();
player = GameObject.FindWithTag("Player");
speed = Random.Range(0.5f, 3.0f);
@@ -25,6 +30,8 @@ public class EnemyScript : MonoBehaviour
// Update is called once per frame
void Update()
{
movement = rb.velocity;
if(player != null)
{
@@ -32,6 +39,10 @@ public class EnemyScript : MonoBehaviour
transform.position, player.transform.position, speed * Time.deltaTime);
}
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetBool("Speed", true);
}
void OnCollisionEnter2D(Collision2D other)
@@ -53,6 +64,8 @@ public class EnemyScript : MonoBehaviour
Instantiate(particleEffect, transform.position, transform.rotation);
Destroy(gameObject);
}
animator.SetBool("Speed", false);
}
}