2021-02-25 00:41:33 +01:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class FallawayFloor : MonoBehaviour
|
|
|
|
{
|
2021-02-25 01:51:11 +01:00
|
|
|
public float speed;
|
|
|
|
Rigidbody rb;
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
rb = GetComponent<Rigidbody>();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
2021-02-25 00:41:33 +01:00
|
|
|
{
|
2021-02-25 01:51:11 +01:00
|
|
|
if (other.gameObject.tag == "Player")
|
|
|
|
{
|
|
|
|
StartCoroutine(DestroyFloor());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IEnumerator DestroyFloor()
|
|
|
|
{
|
|
|
|
rb.velocity = Vector3.down * speed;
|
|
|
|
yield return new WaitForSeconds(1);
|
|
|
|
|
|
|
|
Destroy(gameObject);
|
|
|
|
yield return null;
|
2021-02-25 00:41:33 +01:00
|
|
|
}
|
|
|
|
}
|