经过几次尝试,平台并没有恢复到原来的位置,但后来它被删除了,我不知道如何修复它。
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;
}