You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class RandomStone : MonoBehaviour
|
|
{
|
|
[Range(1,100)]
|
|
public int seed = 1;
|
|
|
|
[Header("随机范围")]
|
|
[Range(5,20)]
|
|
public float Range = 5;
|
|
|
|
[Header("随机比例")]
|
|
[Range(1.5f, 5)]
|
|
public float ScaleRange = 2;
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
{
|
|
|
|
GameObject thiskuang = GameObject.Instantiate(Resources.Load<GameObject>("Prefab/kuang"), Level3Manager.Instance.kuangParent);
|
|
thiskuang.GetComponent<ZoneUI>()._camera = Level3Manager.Instance.cameraGroup[0];
|
|
thiskuang.GetComponent<ZoneUI>().target = this.transform;
|
|
thiskuang.transform.localScale = this.transform.localScale;
|
|
for (int i = 0; i < seed; i++)
|
|
{
|
|
GameObject go = GameObject.Instantiate(this.gameObject, this.transform.parent);
|
|
|
|
go.transform.position = this.transform.position += new Vector3(Random.Range(-Range,Range), Random.Range(-Range, Range)*0.5f, Random.Range(-Range, Range)*0.1f);
|
|
|
|
go.transform.localScale = new Vector3(Random.Range(1f, ScaleRange), Random.Range(1f, ScaleRange), Random.Range(1f, ScaleRange));
|
|
Level3Manager.Instance.StartTimeAction(2.5f, () => {
|
|
go.GetComponent<MeshRenderer>().enabled = true;
|
|
|
|
});
|
|
|
|
|
|
GameObject kuang = GameObject.Instantiate(Resources.Load<GameObject>("Prefab/kuang"),Level3Manager.Instance.kuangParent);
|
|
kuang.GetComponent<ZoneUI>()._camera = Level3Manager.Instance.cameraGroup[0];
|
|
kuang.GetComponent<ZoneUI>().target =go.transform;
|
|
kuang.transform.localScale = go.transform.localScale;
|
|
|
|
|
|
}
|
|
|
|
Level3Manager.Instance.StartTimeAction(2.5f, () => { this.GetComponent<MeshRenderer>().enabled = true; });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|