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

35 lines
602 B
C#
Raw Normal View History

2023-10-24 23:37:59 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
2023-12-03 17:35:43 +08:00
using BITFALL.Props;
2023-10-24 23:37:59 +08:00
using BITKit;
using BITKit.Entities;
using BITKit.Sensors;
using UnityEngine;
2023-12-03 17:35:43 +08:00
namespace BITFALL.Props
2023-10-24 23:37:59 +08:00
{
2023-12-03 17:35:43 +08:00
public class Prop_Grenade : MonoBehaviour
2023-10-24 23:37:59 +08:00
{
2023-12-03 17:35:43 +08:00
[SerializeField] private float fuse;
private async void Start()
2023-10-24 23:37:59 +08:00
{
2023-12-03 17:35:43 +08:00
try
{
await Task.Delay(TimeSpan.FromSeconds(fuse), destroyCancellationToken);
GetComponentInChildren<Prop_Explosive>().Explosion(gameObject);
}
catch (OperationCanceledException)
2023-10-24 23:37:59 +08:00
{
2023-12-03 17:35:43 +08:00
return;
}
2023-10-24 23:37:59 +08:00
}
}
}
2023-12-03 17:35:43 +08:00