added cuttable_tree and axe prefabs

This commit is contained in:
2022-03-28 19:03:33 +03:00
parent 5d197d0958
commit 8e50da0a93
7 changed files with 452 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CuttableTree : MonoBehaviour
{
private Quaternion rotation;
public GameObject myPrefab;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Cutter")
{
Instantiate(myPrefab, transform.position, transform.rotation);
Destroy(gameObject);
}
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "Cutter")
{
rotation = transform.rotation;
rotation *= Quaternion.AngleAxis(20, Vector3.up);
Instantiate(myPrefab, transform.position, rotation);
Destroy(gameObject);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ed5d27829838ec42b4be1d601b4dadc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: