Ejemplo n.º 1
0
 public TreeData(string name, EnumScript.Tree type, float x, float z)
 {
     treeName      = name;
     treeType      = type;
     treePositionX = x;
     treePositionZ = z;
 }
Ejemplo n.º 2
0
    void PlantTree(string treeName, EnumScript.Tree treeType, float treePositionX, float treePositionZ)
    {
        Vector3    treePosition = new Vector3(treePositionX, ConstantScript.root, treePositionZ);
        GameObject newTree      = Instantiate(tree, treePosition, Quaternion.identity);

        newTree.name = treeName;
        newTree.GetComponentInParent <TreeScript>().SetTreeType(treeType);
        switch (treeType)
        {
        case EnumScript.Tree.Normal:
            newTree.GetComponent <Renderer>().material.mainTexture = normalTreeTexture;
            numberOfNormalTree++;
            break;

        case EnumScript.Tree.Apple:
            newTree.GetComponent <Renderer>().material.mainTexture = appleTreeTexture;
            numberOfAppleTree++;
            break;

        case EnumScript.Tree.Orange:
            newTree.GetComponent <Renderer>().material.mainTexture = orangeTreeTexture;
            numberOfOrangeTree++;
            break;
        }
        treeList.Add(new TreeData(treeName, treeType, treePosition.x, treePosition.z));
        UpdateInformation();
    }
Ejemplo n.º 3
0
 public void ChangeTypeOfTree()
 {
     currentTree = (EnumScript.Tree)(((int)currentTree) + 1);
     if ((int)currentTree >= Enum.GetNames(typeof(EnumScript.Tree)).Length)
     {
         currentTree = (EnumScript.Tree)ConstantScript.initial;
     }
     txtChangeType.text = ConstantScript.changeTypeString + currentTree.ToString();
 }
Ejemplo n.º 4
0
 private void Awake()
 {
     treeList           = new List <TreeData>();
     currentTree        = (EnumScript.Tree)ConstantScript.initial;
     currentView        = (EnumScript.View)ConstantScript.initial;
     activeState        = (EnumScript.State)ConstantScript.initial;
     treeId             = ConstantScript.initial;
     numberOfNormalTree = numberOfAppleTree = numberOfOrangeTree = ConstantScript.initial;
     letTreeMove        = false;
     isSave             = false;
     SwitchCamera(currentView);
     ShowPopupWindow(false);
     UpdateInformation();
 }
Ejemplo n.º 5
0
 public void SetTreeType(EnumScript.Tree type)
 {
     treeType = type;
 }