Esempio n. 1
0
File: Tree.cs Progetto: 7aylor/Unity
    /// <summary>
    /// resets health to zero, generates stump health and new lumber yielded amount, sets the treestate to stump
    /// </summary>
    private void InitializeStump()
    {
        health = 0;
        animator.SetBool("Swaying", false);

        switch (treeState)
        {
        case maturity.tiny:
            stumpHealth   = 1;
            lumberYielded = 1;
            break;

        case maturity.small:
            stumpHealth   = 2;
            lumberYielded = 3;
            break;

        case maturity.medium:
            stumpHealth   = 3;
            lumberYielded = 5;
            break;

        case maturity.large:
            stumpHealth   = 5;
            lumberYielded = 10;
            break;
        }

        treeState = maturity.stump;
    }
Esempio n. 2
0
File: Tree.cs Progetto: 7aylor/Unity
    /// <summary>
    /// grow the tree, change the sprite and stats
    /// </summary>
    public void GrowTree()
    {
        treeState += 1;
        UpdateTreeStats();

        //update the forest health UI on grow to Tiny tree
        if (treeState == maturity.tiny)
        {
            forestHealth.UpdateForestHealth();
        }
    }
Esempio n. 3
0
File: Tree.cs Progetto: 7aylor/Unity
 /// <summary>
 /// create the tree in a random state, only used when the level is loaded
 /// </summary>
 private void InitializeTree()
 {
     treeState = (maturity)(Random.Range(1, 5));
     UpdateTreeStats();
 }
Esempio n. 4
0
File: Tree.cs Progetto: 7aylor/Unity
 /// <summary>
 /// Used by the planter when he plants a tree
 /// </summary>
 public void StartAsSeed()
 {
     treeState = maturity.seed;
     UpdateTreeStats();
 }