This commit is contained in:
CortexCore
2023-12-03 17:35:43 +08:00
parent ba342d6627
commit ba9f4eda80
702 changed files with 162078 additions and 21050 deletions

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using BITKit;
using Cysharp.Threading.Tasks.Triggers;
using UnityEngine;
namespace BITFALL.Props
{
public class Prop_C4 : MonoBehaviour,IDescription
{
[SerializeField] private int countdown = 45;
[SerializeField] private new Light light;
private float _initialLightIntensity;
private readonly IntervalUpdate explosionCountdown=new();
private void Start()
{
_initialLightIntensity = light.intensity;
explosionCountdown.Interval = countdown;
explosionCountdown.Reset();
}
private void Update()
{
light.intensity =Mathf.Lerp( _initialLightIntensity,0, (float)explosionCountdown.Remaining % 1);
if (explosionCountdown.AllowUpdate)
{
GetComponentInChildren<Prop_Explosive>().Explosion(gameObject);
}
}
public string Name=>"C4: 预计剩余时间: "+explosionCountdown.Remaining.ToString("F2")+"s";
}
}