Santi
b0be1fdd96
Player can throw rocks at enemy to slow them down. Enemy script split into two scripts, one for movement and one for detection. Added and edited some comments.
46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
//* General Comments or Finished Tasks
|
|
//TODO Tasks left to be done for game
|
|
//! Bugs or Issues
|
|
//? Questions or Suggestions
|
|
|
|
public class Catch : MonoBehaviour
|
|
{
|
|
public int score;
|
|
public TextMeshProUGUI scoreText;
|
|
public Movement movement;
|
|
|
|
private void OnTriggerEnter(Collider other) {
|
|
if(other.gameObject.tag == "PickupObject")
|
|
{
|
|
Destroy(other.gameObject);
|
|
score = score + 1;
|
|
scoreText.text = "Score: " + score;
|
|
}
|
|
else if(other.gameObject.tag == "Bomb")
|
|
{
|
|
Destroy(other.gameObject);
|
|
score = score - 3;
|
|
scoreText.text = "Score: " + score;
|
|
StartCoroutine(ConcussionTime());
|
|
}
|
|
else if(other.gameObject.tag == "SpecialObject")
|
|
{
|
|
Destroy(other.gameObject);
|
|
score = score + 2;
|
|
scoreText.text = "Score: " + score;
|
|
}
|
|
}
|
|
|
|
IEnumerator ConcussionTime()
|
|
{
|
|
movement.speed = 0;
|
|
yield return new WaitForSeconds(2);
|
|
movement.speed = 7.0f;
|
|
}
|
|
}
|