void Fall(int side)
        {
            int oppositeSide = side % 2 == 0 ? (side + 1) : (side - 1);

            transform.parent.GetComponentInChildren <LoggingActivityInteractPrompt>().HideUI();

            ApplyFallingForce(oppositeSide);
            hasFallen = true;

            foreach (ForestTreeSnapSpot snap in transform.GetComponentsInChildren <ForestTreeSnapSpot>())
            {
                snap.enabled = false;
            }
            LoggingActivityPlayerBehavior.UnsnapPlayer();
            GetComponent <ForestTreeBehavior>().enabled = false;

            int qualityAverage = QualityMinigame.CalculateAverageGrade();

            qualityAverage = Mathf.Clamp(qualityAverage, 0, maxQualityGrade.GetHashCode());

            QualityGrade gatheredQuality = (QualityGrade)qualityAverage;

            HomesteadStockpile.UpdateTreesCountAtGrade(gatheredQuality, 1);

            Debug.Log("Gathered Grade: " + gatheredQuality);

            //Visually phase tree out
            Invoke("PhaseOutTree", 5);
        }
    public DevResourceQuantity GenerateDevResourcePayout()
    {
        DevResourceQuantity treeRate     = LumberContractHelper.FelledTreeExchangeRates[treeGrade.GetHashCode()];
        DevResourceQuantity logRate      = LumberContractHelper.LogExchangeRates[logGrade.GetHashCode()];
        DevResourceQuantity firewoodRate = LumberContractHelper.FirewoodExchangeRates[firewoodGrade.GetHashCode()];

        int currency  = (treeRate.GetCurrency() * trees) + (logRate.GetCurrency() * logs) + (firewoodRate.GetCurrency() * firewood);
        int materials = 0;
        int parts     = 0;
        int pages     = 0;

        int[] resourceIndexes =
        {
            UnityEngine.Random.Range(1, 4),
            UnityEngine.Random.Range(1, 4),
            UnityEngine.Random.Range(1, 4),
        };

        int [] lumberPayouts =
        {
            treeRate.GetResourceAtIndex(resourceIndexes[0]) * trees,
            logRate.GetResourceAtIndex(resourceIndexes[1]) * (logs / 3),
            firewoodRate.GetResourceAtIndex(resourceIndexes[2]) * (firewood / 6),
        };

        for (int i = 0; i < resourceIndexes.Length; i++)
        {
            if (resourceIndexes[i] == 1)
            {
                materials += lumberPayouts[i];
            }
            else if (resourceIndexes[i] == 2)
            {
                parts += lumberPayouts[i];
            }
            else if (resourceIndexes[i] == 3)
            {
                pages += lumberPayouts[i];
            }
        }


        return(new DevResourceQuantity(currency, materials, parts, pages));
    }
        void SawThrough(int loc)
        {
            if (locationFullySawed[0] && locationFullySawed[1])
            {
                LoggingActivityPlayerBehavior.UnsnapPlayer();

                int qualityAverage = QualityMinigame.CalculateAverageGrade();
                qualityAverage = Mathf.Clamp(qualityAverage, 0, maxQualityGrade.GetHashCode());

                QualityGrade gatheredQuality = (QualityGrade)qualityAverage;

                HomesteadStockpile.UpdateLogsCountAtGrade(gatheredQuality, 3);
                HomesteadStockpile.UpdateTreesCountAtGrade(maxQualityGrade, -1);

                Debug.Log("Gathered Grade: " + gatheredQuality);

                Invoke("PhaseOutLogs", 1.0f);
            }
        }
Example #4
0
        void Split()
        {
            ApplySplitForce();

            LoggingActivityPlayerBehavior.UnsnapPlayer();

            int qualityAverage = QualityMinigame.CalculateAverageGrade(HomesteadStockpile.GetLogsCountAtGrade(maxQualityGrade));

            qualityAverage = Mathf.Clamp(qualityAverage, 0, maxQualityGrade.GetHashCode());

            QualityGrade gatheredQuality = (QualityGrade)qualityAverage;

            HomesteadStockpile.UpdateFirewoodCountAtGrade(gatheredQuality, QualityMinigame.GetUngradedFirewood());

            QualityMinigame.ClearUngradedFirewood();

            Debug.Log("Gathered Grade: " + gatheredQuality);

            Invoke("PhaseOutFirewood", 5f);
        }
Example #5
0
 public static void UpdateLogsCountAtGrade(QualityGrade grade, int changeValue)
 {
     logs[grade.GetHashCode()] = Mathf.Clamp((logs[grade.GetHashCode()] += changeValue), 0, PlayerSkills.GetMaxLumberLogsValue());
 }
Example #6
0
 public static void SetLogsCountAtGrade(QualityGrade grade, int newValue)
 {
     logs[grade.GetHashCode()] = Mathf.Clamp(newValue, 0, PlayerSkills.GetMaxLumberLogsValue());
 }
Example #7
0
 public static int GetLogsCountAtGrade(QualityGrade grade)
 {
     return(logs[grade.GetHashCode()]);
 }
Example #8
0
 public static int GetTreesCountAtGrade(QualityGrade grade)
 {
     return(trees[grade.GetHashCode()]);
 }
Example #9
0
 public static void UpdateFirewoodCountAtGrade(QualityGrade grade, int changeValue)
 {
     firewood[grade.GetHashCode()] = Mathf.Clamp((firewood[grade.GetHashCode()] += changeValue), 0, PlayerSkills.GetMaxLumberFirewoodValue());
 }
Example #10
0
 public static void SetFirewoodCountAtGrade(QualityGrade grade, int newValue)
 {
     firewood[grade.GetHashCode()] = Mathf.Clamp(newValue, 0, PlayerSkills.GetMaxLumberFirewoodValue());
 }
Example #11
0
 public static int GetFirewoodCountAtGrade(QualityGrade grade)
 {
     return(firewood[grade.GetHashCode()]);
 }