Component for describing a tree species and its distribution (i.e., a serializable DetailPrototype)
Inheritance: MonoBehaviour
Beispiel #1
0
    private void OnMouseOver()
    {
        if (Input.GetMouseButtonDown(0) && select && isEmpty && Time.timeScale == 1f)
        {
            select     = gameManager.GetComponent <ButtonToggler>().Select = false;
            properties = gameManager.GetComponent <ButtonToggler>().toggle.GetComponent <TreeProperties>();
            tree.GetComponent <TreeHandler>().InitialiseAttribute(properties.health, properties.seedValue,
                                                                  properties.scoreValue, properties.harvestTime, properties.treeTypeNumber,
                                                                  properties.mapleMod, properties.mapleTimer, properties.healCount, properties.healAmount);
            Instantiate(tree, new Vector3(transform.position.x, transform.position.y, -1f),
                        Quaternion.identity);
            GameManager.seed -= properties.seedCost;

            treeInLand = Physics2D.Raycast(transform.position, Vector2.up, 0.3f).transform.gameObject;
            // play plant clip
            GetComponent <AudioSource>().PlayOneShot(plantClip);
            isEmpty = false;

            //Sets planted tree's button on cooldown
            gameManager.GetComponent <ButtonToggler>().toggle.GetComponent <TreeCooldownHandler>().SetCooldownTimer();
        }
    }
 public void SetTreePropertyValues(TreeProperties treeProperties)
 {
     this.treeProperties = treeProperties;
     leafIndex           = treeProperties.leafMatNumber;
     barkIndex           = treeProperties.barkMatNumber;
 }