示例#1
0
    public bool Init()
    {
        UTestPrototypes.Init();

        m_instRoot = GameObject.Find("Instances");
        if (m_instRoot == null)
        {
            return(false);
        }

        m_metalod = new UMetaLod();
        for (int i = 0; i < 3000; i++)
        {
            MetaLodTargetGameObject target = UTestPrototypes.NewRandom();
            if (target != null)
            {
                target.gameObject.transform.localPosition = NewRandomPoint();
                target.gameObject.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);
                target.gameObject.transform.localRotation = Quaternion.Euler(0.0f, Random.Range(0.0f, 360.0f), 0.0f);
                target.gameObject.transform.parent        = m_instRoot.transform;
                m_metalod.AddTarget(target);
            }
        }

        return(true);
    }
示例#2
0
    public static MetaLodTargetGameObject NewRandom()
    {
        int i = Random.Range(0, Prototypes.Count - 1);

        if (Prototypes[i] == null)
        {
            return(null);
        }

        MetaLodTargetGameObject target = new MetaLodTargetGameObject();

        target.gameObject = Object.Instantiate(Prototypes[i]) as GameObject;
        return(target);
    }
示例#3
0
    public void Update(Vector3 position)
    {
        MetaLodTargetGameObject.PlayerPos = position;
        m_metalod.Update();

        foreach (var target in m_metalod.Targets)
        {
            MetaLodTargetGameObject tgo = target as MetaLodTargetGameObject;
            Vector3 pos  = tgo.gameObject.transform.position;
            Rect    rect = new Rect()
            {
            };
            rect.center = new Vector2(pos.x, pos.z);
            rect.size   = new Vector2(5.0f, 5.0f);
            UCore.DrawRect(rect, 10.0f, new Color(tgo.Liveness, 0, 0, 1));
        }
    }
示例#4
0
    public static MetaLodTargetGameObject NewRandom()
    {
        int i = Random.Range(0, Prototypes.Count - 1);
        if (Prototypes[i] == null)
            return null;

        MetaLodTargetGameObject target = new MetaLodTargetGameObject();
        target.gameObject = Object.Instantiate(Prototypes[i]) as GameObject;
        return target;
    }