particles on hit planet
This commit is contained in:
parent
14f3a2dda5
commit
f61dbb9edd
@ -30,7 +30,6 @@ public class CannonScript : MonoBehaviour
|
|||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
Debug.DrawRay(transform.position, lookDir * Mathf.Infinity, Color.red);
|
Debug.DrawRay(transform.position, lookDir * Mathf.Infinity, Color.red);
|
||||||
Debug.Log(EventSystem.current.IsPointerOverGameObject());
|
|
||||||
|
|
||||||
if (firing && !EventSystem.current.IsPointerOverGameObject()){
|
if (firing && !EventSystem.current.IsPointerOverGameObject()){
|
||||||
fireTimer += Time.deltaTime;
|
fireTimer += Time.deltaTime;
|
||||||
|
|||||||
@ -15,6 +15,7 @@ public class DimensionController : MonoBehaviour
|
|||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
|
StartCoroutine(other.GetComponent<Enemy>().InstantDestroy());
|
||||||
if (_hp <= 0) { return; }
|
if (_hp <= 0) { return; }
|
||||||
|
|
||||||
var enemy = other.GetComponent<Enemy>();
|
var enemy = other.GetComponent<Enemy>();
|
||||||
@ -23,9 +24,6 @@ public class DimensionController : MonoBehaviour
|
|||||||
// Update HP (temp for now)
|
// Update HP (temp for now)
|
||||||
_hp -= enemy.DamageDealt();
|
_hp -= enemy.DamageDealt();
|
||||||
|
|
||||||
// Destroy projectile
|
|
||||||
Destroy(other.gameObject);
|
|
||||||
|
|
||||||
GameManager.Instance.DealDamage(dimensionId, _hp, _maxHp);
|
GameManager.Instance.DealDamage(dimensionId, _hp, _maxHp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,18 @@ public class Enemy : MonoBehaviour
|
|||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerator InstantDestroy()
|
||||||
|
{
|
||||||
|
gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * (flyingSpeed / 3);
|
||||||
|
body.SetActive(false);
|
||||||
|
explosion.Emit(100);
|
||||||
|
explosionDebris.Emit(40);
|
||||||
|
yield return new WaitForSeconds(.1f);
|
||||||
|
collider.enabled = false;
|
||||||
|
yield return new WaitForSeconds(1f);
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
IEnumerator playDmgParticles(float waitTime)
|
IEnumerator playDmgParticles(float waitTime)
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(waitTime);
|
yield return new WaitForSeconds(waitTime);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user