【发布时间】:2019-05-23 00:28:22
【问题描述】:
经过几次尝试,平台并没有回到原来的位置,但后来它被删除了,我不知道如何修复它。
public class FallingPlatform : MonoBehaviour
{
private Rigidbody2D rb;
// Use this for initialization
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
private void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.name.Equals("Ellen"))
{
Invoke("DropPlatform", 0.5f);
Destroy(gameObject, 2f);
InvokeRepeating("DropPlatform", 0.5F);
respawn(gameObject, 2f);
}
}
private void InvokeRepeating(string v1, float v2)
{
throw new NotImplementedException();
}
private void respawn(GameObject gameObject, float v)
{
throw new NotImplementedException();
}
private void DropPlatform()
{
rb.isKinematic = false;
}
【问题讨论】:
-
如果你的平台在下降,那你为什么不把
GravityScale改成0 -
为什么要将 isKinematic 设置为 false?
-
怎么样。我不明白为什么它不这样做。
标签: c# unity3d social-gaming