WARNING! DON’T READ ON! EXTREME NOOB ALERT!!
Hi!
I’m trying to make a survival game, and my world is a terrain. I have used the terrain>trees option to build my environment. But, I need help cutting them down. I have NOOO clue. I checked some other posts on the forums, but they all seem so complex!! There has to be a simple way of doing it without having to create each tree individually!?
-Thanks!
There is no “simple” way to cut down trees, such a feature is too specific to a certain type of game to build-in.
When I say simple, I just mean like not 40000 lines. Something more like 300 - 500.
I suppose you could make the trees separate objects, add a trigger to them, and do something like this.
void OnTriggerStay(collider c)
{
if (c.gameObject.tag == "Player")
{
if (Input.GetMouseButtonDown(0)) // Might be problematic in OnTriggerStay, I can't remember
{
c.gameObject.GetComponent<Inventory>().AddWood(); //change this to however you handle player resources
Destroy(gameObject);
}
}
}
Thanks! I think what I’m going to do is add some trees that are ‘Eligible to Harvest’ Meaning you can only harvest some trees because the others might not have suitable wood. And, each one of those trees will be a separate object. Thanks! (PS I’m only just a beginner!) Shhhhhh!