Files
BlueArchiveMiniGame/Assets/Scripts/HotUpdate/Main/Dialogue/FallingObj.cs

23 lines
622 B
C#
Raw Normal View History

2025-10-23 11:50:16 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FallingObj : MonoBehaviour
{
public float delay;
public Vector3 force;
public void Init(float delay, Vector3 force)
{
this.delay = delay;
this.force = force;
StartCoroutine(Falling());
}
IEnumerator Falling()
{
yield return new WaitForSeconds(delay);
gameObject.AddComponent<MeshCollider>().convex = true;
//gameObject.AddComponent<Rigidbody>().useGravity = false;
gameObject.AddComponent<Rigidbody>().AddForce(force,ForceMode.Impulse);
}
}