Component for describing a tree species and its distribution (i.e., a serializable DetailPrototype)
Inheritance: MonoBehaviour
コード例 #1
0
ファイル: TileScript.cs プロジェクト: faberwerks/protectors
    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();
        }
    }
コード例 #2
0
 public void SetTreePropertyValues(TreeProperties treeProperties)
 {
     this.treeProperties = treeProperties;
     leafIndex           = treeProperties.leafMatNumber;
     barkIndex           = treeProperties.barkMatNumber;
 }