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.
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;
|
|
}
|
|
}
|