Files
gmtk-2021/Assets/Scripts/Items/DestructibleObject.cs
2021-06-12 00:05:27 +01:00

22 lines
540 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestructibleObject : MonoBehaviour
{
private Vector3 originalPosition;
// Start is called before the first frame update
void Start()
{
originalPosition = gameObject.transform.position;
}
public void Respawn()
{
gameObject.GetComponent<Rigidbody>().isKinematic = true;
gameObject.transform.position = originalPosition;
gameObject.GetComponent<Rigidbody>().isKinematic = false;
}
}