using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Boulder : HeavyObject
|
|
{
|
|
public GameObject splash;
|
|
public GameObject Explosion;
|
|
|
|
private int transparentLayer;
|
|
|
|
void Awake()
|
|
{
|
|
transparentLayer = LayerMask.NameToLayer("TransparentFX");
|
|
}
|
|
|
|
public override void OnWaterStay(WaterController water,float waveHeight)
|
|
{
|
|
}
|
|
|
|
public override void OnWaterExit(WaterController water)
|
|
{
|
|
}
|
|
|
|
void OnTriggerEnter(Collider other) {
|
|
if (other.gameObject.layer == transparentLayer)
|
|
return;
|
|
if (other.gameObject.CompareTag("Water"))
|
|
{
|
|
NotificationServer.notify("play sfx", "rockWater_3:0.8");
|
|
Destroy(Instantiate(splash, transform.position,Quaternion.identity), 2.5f);
|
|
}
|
|
else if (other.gameObject.CompareTag("Player"))
|
|
{
|
|
NotificationServer.notify("play sfx", "runAground:1");
|
|
Destroy(Instantiate(Explosion, transform.position, Quaternion.identity), 6);
|
|
PlayerController.instance.takeOneDamage();
|
|
}
|
|
else
|
|
{
|
|
NotificationServer.notify("play sfx", "runAground:1");
|
|
Destroy(Instantiate(Explosion, transform.position, Quaternion.identity), 6);
|
|
}
|
|
NotificationServer.notify("BoulderHit");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|