You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.2 KiB

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");
}
}