Merge branch 'staging' into unified_scene
This commit is contained in:
39
Assets/Project Files/Scripts/Arlo/CuttableTree.cs
Normal file
39
Assets/Project Files/Scripts/Arlo/CuttableTree.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class CuttableTree : MonoBehaviour
|
||||
{
|
||||
private Quaternion rotation;
|
||||
public GameObject stumpPrefab;
|
||||
public GameObject logPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private UnityEvent onCut;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.tag == "Cutter")
|
||||
{
|
||||
rotation = transform.rotation;
|
||||
rotation *= Quaternion.AngleAxis(20, Vector3.up);
|
||||
Instantiate(stumpPrefab, transform.position, rotation);
|
||||
Instantiate(logPrefab, transform.position+new Vector3(0, 1, 0), rotation);
|
||||
onCut.Invoke();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Project Files/Scripts/Arlo/CuttableTree.cs.meta
Normal file
11
Assets/Project Files/Scripts/Arlo/CuttableTree.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ed5d27829838ec42b4be1d601b4dadc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user