BITFALL/Assets/Artists/Scripts/Props/Prop_Grenade.cs

35 lines
602 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BITFALL.Props;
using BITKit;
using BITKit.Entities;
using BITKit.Sensors;
using UnityEngine;
namespace BITFALL.Props
{
public class Prop_Grenade : MonoBehaviour
{
[SerializeField] private float fuse;
private async void Start()
{
try
{
await Task.Delay(TimeSpan.FromSeconds(fuse), destroyCancellationToken);
GetComponentInChildren<Prop_Explosive>().Explosion(gameObject);
}
catch (OperationCanceledException)
{
return;
}
}
}
}