31 lines
559 B
C#
31 lines
559 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ChangeLayerAtPosition : MonoBehaviour
|
|
{
|
|
public string newLayer = "Terrain";
|
|
|
|
public float minHeight;
|
|
|
|
public List<GameObject> objectsToActivate = new List<GameObject>();
|
|
|
|
private void Awake()
|
|
{
|
|
if (base.transform.position.y > minHeight)
|
|
{
|
|
return;
|
|
}
|
|
if (objectsToActivate.Count > 0)
|
|
{
|
|
for (int i = 0; i < objectsToActivate.Count; i++)
|
|
{
|
|
objectsToActivate[i].SetActive(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Utilities.SetLayerRecursively(base.gameObject, newLayer);
|
|
}
|
|
}
|
|
}
|