24 lines
690 B
C#
24 lines
690 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class NoSeeLongDistance : MyCoroutine
|
|
{
|
|
public bool BaseOnPC = true;
|
|
public float Dist = 120f;
|
|
List<GameObject> list = new List<GameObject>();
|
|
|
|
private void Awake()
|
|
{
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
list.Add(transform.GetChild(i).gameObject);
|
|
|
|
Transform baseTF = BaseOnPC ? MyValue.MyPC.transform : Camera.main.transform;
|
|
|
|
Act_Repeat_for1sec = () =>
|
|
{
|
|
for (int i = 0; i < list.Count; i++)
|
|
list[i].SetActive(Vector3.Distance(list[i].transform.position, baseTF.position) < Dist);
|
|
};
|
|
}
|
|
} |