Files
gmtk-2021/Assets/Scripts/Items/DestructibleObject.cs
Jan Groß ee7a16dd2e Finalized for game jam submission
Lots of bugfixes
New tasks
2021-06-13 20:37:07 +02:00

23 lines
584 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.transform.parent = null;
gameObject.GetComponent<Rigidbody>().isKinematic = false;
}
}