47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
//* General Comments or Finished Tasks
|
||
|
//TODO Tasks left to be done for game
|
||
|
//! Bugs or Issues
|
||
|
//? Questions or Suggestions
|
||
|
|
||
|
//* Rock must detect what it hits
|
||
|
//* If rock hits enemy, enemy slows down
|
||
|
//* Rock hitting enemy needs to destroy the rock
|
||
|
//TODO Particles for hitting an enemy
|
||
|
|
||
|
public class RockScript : MonoBehaviour
|
||
|
{
|
||
|
public ParticleSystem bonkParticles;
|
||
|
private GameObject contact;
|
||
|
public bool particles = false;
|
||
|
public AIScript AIScript;
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
private void OnCollisionEnter(Collision other) {
|
||
|
if(other.gameObject.tag == "Enemy")
|
||
|
{
|
||
|
//* Play the bonk particles
|
||
|
// var parLocation = Instantiate(bonkParticles, contact.transform.position, Quaternion.identity);
|
||
|
// Destroy(parLocation, 1);
|
||
|
particles = true;
|
||
|
AIScript.isHit = true;
|
||
|
StartCoroutine(BonkTimer());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
IEnumerator BonkTimer()
|
||
|
{
|
||
|
yield return new WaitForSeconds(2);
|
||
|
AIScript.isHit = false;
|
||
|
particles = false;
|
||
|
}
|
||
|
}
|