Ejemplo n.º 1
0
 public void CreatTreeModel(TreeManger treeManger)
 {
     for (int i = 0; i < m_datainfolist.stageTreeDataList.Count; i++)
     {
         MaoTreeControl go = GameObject.Instantiate(Resources.Load <GameObject>("MaoTree/" + "MaoTree"), m_datainfolist.stageTreeDataList[i].Pos, Quaternion.identity).GetComponent <MaoTreeControl>();
         go.GetComponent <MaoTreeControl>().Art = GameObject.Instantiate(Resources.Load <GameObject>("MaoTree/" + m_datainfolist.stageTreeDataList[i].Type), go.transform.position, Quaternion.identity, go.transform);
         go.GetComponent <MaoTreeControl>().Initialized(m_datainfolist.stageTreeDataList[i].Type);
         go.GetComponent <MaoTreeControl>().data = this;
         go.GetComponent <MaoTreeControl>().growMaoControl.waitTime = m_datainfolist.stageTreeDataList[i].WaitTime;
         //go.GetComponent<MaoTreeControl>().growMaoControl.growState = 1;
         go.GetComponent <MaoTreeControl>().growMaoControl.growState = m_datainfolist.stageTreeDataList[i].State;
         if (!m_datainfolist.stageTreeDataList[i].IsFirstTime)
         {
             m_datainfolist.stageTreeDataList[i].IsFirstTime               = true;
             go.GetComponent <MaoTreeControl>().growMaoControl.growState   = 1;
             go.GetComponent <MaoTreeControl>().growMaoControl.currentTime = 18;
         }
         else
         {
             go.GetComponent <MaoTreeControl>().growMaoControl.currentTime = m_datainfolist.stageTreeDataList[i].CurrentWaitTime;
             if (m_datainfolist.stageTreeDataList[i].State == 0)
             {
                 go.GetComponent <MaoTreeControl>().Art.transform.localScale = new Vector3(.5f, .5f, .5f);
             }
         }
         //Debug.Log("Creatstate : - " +  m_datainfolist.stageTreeDataList[i].State);
         treeManger.MaoTree.Add(go);
     }
 }
Ejemplo n.º 2
0
    private void CreatMaoTree()
    {
        StageMaoTreeInfo treeInfo = new StageMaoTreeInfo();

        treeInfo.WaitTime = 20;
        treeInfo.State    = 0;
        tree        = treeManger.CreatMaoTree(this.transform.position, Type, treeInfo).GetComponent <MaoTreeControl>();//-------
        tree.Player = Player;
    }
Ejemplo n.º 3
0
    public void CheckPlarerInRange()
    {
        foreach (MaoTreeControl tree in MaoTree)
        {
            if (Vector3.Distance(tree.Art.transform.position, Player.transform.position) < 5)
            {
                tree.NearPlayer = true;
            }
            else
            {
                tree.NearPlayer = false;
            }
        }

        foreach (HoleControl hole in MaoHole)
        {
            if (hole.IsOn)
            {
                if (Player.GetComponent <NewPlayerController>().holeList.Contains(hole))
                {
                    hole.holeTutorial.SetActive(false);
                    Player.GetComponent <NewPlayerController>().holeList.Remove(hole);
                }
                MaoTreeControl tree = hole.tree;
                if (Vector3.Distance(tree.Art.transform.position, Player.transform.position) < 5 && tree.CreatFinish)
                {
                    tree.NearPlayer = true;
                }
                else
                {
                    tree.NearPlayer = false;
                }
            }
            else
            {
                if (Vector3.Distance(hole.gameObject.transform.position, Player.transform.position) < 3)
                {
                    hole.NearPlayer = true;
                    //Player.GetComponent<NewPlayerController>().NearHole = true;
                    if (!Player.GetComponent <NewPlayerController>().holeList.Contains(hole))
                    {
                        Player.GetComponent <NewPlayerController>().holeList.Add(hole);
                        hole.holeTutorial.SetActive(true);
                    }
                    else
                    {
                    }
                }
                else
                {
                    hole.NearPlayer = false;
                    hole.holeTutorial.SetActive(false);
                    //Player.GetComponent<NewPlayerController>().NearHole = false;
                    if (Player.GetComponent <NewPlayerController>().holeList.Contains(hole))
                    {
                        Player.GetComponent <NewPlayerController>().holeList.Remove(hole);
                    }
                }
            }
        }
    }