예제 #1
0
    /// <summary>
    ///生成种子
    /// </summary>
    public void GenerateTrail(BotanyBase item)
    {
        serialnumber = BotanyList.Count;
        BotanyBase botanybase = new BotanyBase(item);

        BotanyList.Add(botanybase);
    }
예제 #2
0
    public void Generate()
    {
        BotanyBase a = null;

        GenerateTrail(a);
        GenerateTrail(a);
    }
예제 #3
0
 /// <summary>
 ///生成种子
 /// </summary>
 public void GenerateTrail(params BotanyBase[] tran)
 {
     if (tran.Length <= 0)
     {
         return;
     }
     foreach (var item in tran)
     {
         serialnumber = BotanyList.Count;
         BotanyBase botanybase = new BotanyBase(item);
         BotanyList.Add(botanybase);
     }
 }
예제 #4
0
    /// <summary>
    /// 创建时调用
    /// </summary>
    /// <param name="pos"></param>
    void Create(BotanyBase father)
    {
        Object node = Resources.Load("Botany/node");

        Serialnumber = MainManger.Instance.serialnumber;
        if (father == null)
        {
            float y = Serialnumber == 0 ? 0.5f : -0.5f;
            beginPos   = new Vector3(0, Serialnumber, MainManger.Instance.Bg.transform.position.z);
            SphereNode = UnityEngine.Object.Instantiate(node, MainManger.Instance.Bg.transform.position - 2 * Vector3.back, Quaternion.Euler(Vector3.zero)) as GameObject;
            SphereNode.transform.position    = MainManger.Instance.Bg.transform.position + 0.2f * Vector3.back;
            SphereNode.transform.position   += (0.5f * (Serialnumber == 0 ? Vector3.up : Vector3.down));
            SphereNode.transform.eulerAngles = Vector3.zero;
        }
        else
        {
            SphereNode = UnityEngine.Object.Instantiate(node, father.SphereNode.transform.position, father.SphereNode.transform.rotation) as GameObject;
        }
        forward = SphereNode.transform.Find("forward").gameObject;
        //SphereNode.tag = "Botany";
        SphereNode.transform.SetParent(MainManger.Instance.TrailRoot.transform);
        SphereNode.name       = MainManger.Instance.serialnumber.ToString("000");
        MainTrail             = SphereNode.transform.Find("Trail").gameObject.GetComponent <TrailRenderer>();
        MainTrail.time        = 360000000000f;
        MainTrail.startWidth *= scale;
        MainTrail.endWidth   *= scale;
        target = SphereNode.transform.Find("target").gameObject;
        if (father != null)
        {
            scale = father.scale * reducescale;
            MainTrail.transform.position = new Vector3(father.SphereNode.transform.position.x, father.SphereNode.transform.position.y, MainTrail.transform.position.z);
            DataInit(father.BotanyType);
        }
        else
        {
            DataInit(Serialnumber == 0 ? EnumBotanyType.TypeUp : EnumBotanyType.TypeDown);
        }
        SphereNode.transform.localScale *= scale;//缩放
        MainTrail.transform.position     = SphereNode.transform.position;
    }
예제 #5
0
 public BotanyBase(BotanyBase father)
 {
     Create(father);
 }
예제 #6
0
 public BotanyBase SelectFunc(GameObject obj)
 {
     CurSelect = BotanyList.Find(o => o.SphereNode.Equals(obj));
     return(CurSelect);
 }