log creation

This commit is contained in:
2022-04-04 19:04:09 +03:00
parent 51d75b196d
commit bf6bbc6723
4 changed files with 301 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ public class CuttableTree : MonoBehaviour
{
private Quaternion rotation;
public GameObject stumpPrefab;
public GameObject logPrefab;
[SerializeField]
private UnityEvent onCut;
@@ -30,8 +31,9 @@ public class CuttableTree : MonoBehaviour
rotation = transform.rotation;
rotation *= Quaternion.AngleAxis(20, Vector3.up);
Instantiate(stumpPrefab, transform.position, rotation);
Destroy(gameObject);
Instantiate(logPrefab, transform.position+new Vector3(0, 1, 0), rotation);
onCut.Invoke();
Destroy(gameObject);
}
}
}