Santi
16784160a1
CubeGravity - Added increased gravity to the special object BoxTP_Catch - Added spcial object, more items spawn as timer goes down, at 0 game stops.
47 lines
1.2 KiB
C#
47 lines
1.2 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
|
|
|
|
//* Fix objects giving the player double points
|
|
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;
|
|
}
|
|
}
|