public TreeData(string name, EnumScript.Tree type, float x, float z) { treeName = name; treeType = type; treePositionX = x; treePositionZ = z; }
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(); }
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(); }
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(); }
public void SetTreeType(EnumScript.Tree type) { treeType = type; }