Beispiel #1
0
 public void BuyDrone()
 {
     if (CurrentTurret != null)
     {
         DeSelectTurret();
     }
     if (money >= DroneCost)
     {
         money -= DroneCost;
         Drone.SetActive(true);
         DroneBought = true;
         if (!WaveManager.Instance.WaveStarted)
         {
             DronePoints.SetActive(true);
         }
         DroneButton.interactable = false;
     }
 }
Beispiel #2
0
 public virtual void SellTurret()
 {
     if (CurrentTurret.GetComponent <Radar>())
     {
         ScanRadars(true);
         Radars.Remove(CurrentTurret.GetComponent <Radar>());
     }
     if (CurrentTurret.GetComponent <FlyingTurret>())
     {
         DronePoints.SetActive(false);
         DroneButton.interactable = true;
         Drone.SetActive(false);
     }
     else
     {
         Destroy(CurrentTurret.gameObject);
     }
     money += CurrentTurret.SellPrice;
     DeSelectTurret();
 }
Beispiel #3
0
        /// <summary>
        /// Update processing points
        /// </summary>
        ///

        private void UpdateUI()
        {
            //Debug.Log(System.Math.Round(creativityData.CurrentCreativityPoints, 1) + " CREATIVITY " + System.Math.Round(CreativityPoints, 1));
            //Debug.Log(System.Math.Round(researchData.CurrentResearchPoints, 1) + " RESEARCH " + System.Math.Round(ResearchPoints, 1));

            if (name.text != string.Empty && PlayerPrefs.GetString("Name") != null)
            {
                name.text = PlayerPrefs.GetString("Name");
            }
            processing.text = " " + UpgradeAbilities.TEMPALLOCATIONPOOL + "/" + UpgradeAbilities.ALLOCATIONPOOL.ToString();
            if (UpgradeAbilities.CURRENTALLOCATIONPOOL < UpgradeAbilities.ALLOCATIONPOOL)
            {
                processing.color = Color.green;
                TimerManager.Instance.AddTimer(() => { processing.color = Color.white; }, 0.5f);
            }
            else if (UpgradeAbilities.CURRENTALLOCATIONPOOL > UpgradeAbilities.ALLOCATIONPOOL)
            {
                processing.color = Color.red;
                TimerManager.Instance.AddTimer(() => { processing.color = Color.white; }, 0.5f);
            }

            Research.text = " " + ResearchPoints.ToString("0.0") + "/" + ResearchLimit.ToString() + "(+" + ResearchGain.ToString("0.0") + ")";
            if (System.Math.Round(researchData.CurrentResearchPoints, 1) > System.Math.Round(ResearchPoints, 1))
            {
                Research.color = Color.green;
            }
            else if (System.Math.Round(researchData.CurrentResearchPoints, 1) < System.Math.Round(ResearchPoints, 1))
            {
                Research.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Research.color = Color.white; }, 0.1f);
            }

            Creativity.text = " " + CreativityPoints.ToString("0.0") + "(+" + CreativityGain.ToString("0.0") + ")";
            if (System.Math.Round(creativityData.CurrentCreativityPoints, 1) > System.Math.Round(CreativityPoints, 1))
            {
                Creativity.color = Color.green;
            }
            else if (System.Math.Round(creativityData.CurrentCreativityPoints, 1) < System.Math.Round(CreativityPoints, 1))
            {
                Creativity.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Creativity.color = Color.white; }, 0.1f);
            }

            Funds.text = " " + fundsPoints.ToString("0.0") + "(+" + fundsGain.ToString("0.0") + ")";
            if (System.Math.Round(fundsData.CurrentFundsPoints, 1) > System.Math.Round(fundsPoints, 1))
            {
                Funds.color = Color.green;
            }
            else if (System.Math.Round(fundsData.CurrentFundsPoints, 1) < System.Math.Round(fundsPoints, 1))
            {
                Funds.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Funds.color = Color.white; }, 0.1f);
            }

            Influence.text = " " + influencePoints.ToString("0.0") + "(+" + influenceGain.ToString("0.0") + ")";
            if (System.Math.Round(influenceData.CurrentInfluencePoints, 1) > System.Math.Round(influencePoints, 1))
            {
                Influence.color = Color.green;
            }
            else if (System.Math.Round(influenceData.CurrentInfluencePoints, 1) < System.Math.Round(influencePoints, 1))
            {
                Influence.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Influence.color = Color.white; }, 0.1f);
            }

            Power.text = " " + powerPoints.ToString("0.0") + "(+" + powerGain.ToString("0.0") + ")";
            if (System.Math.Round(powerData.CurrentPowerPoints, 1) > System.Math.Round(powerPoints, 1))
            {
                Power.color = Color.green;
            }
            else if (System.Math.Round(powerData.CurrentPowerPoints, 1) < System.Math.Round(powerPoints, 1))
            {
                Power.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Power.color = Color.white; }, 0.1f);
            }

            Material.text = " " + materialPoints.ToString("0.0") + "(+" + materialGain.ToString("0.0") + ")";
            if (System.Math.Round(materialData.CurrentMaterialPoints, 1) > System.Math.Round(materialPoints, 1))
            {
                Material.color = Color.green;
            }
            else if (System.Math.Round(materialData.CurrentMaterialPoints, 1) < System.Math.Round(materialPoints, 1))
            {
                Material.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Material.color = Color.white; }, 0.1f);
            }

            Drone.text = " " + DronePoints.ToString("0") + "/" + DroneLimit.ToString("0") + "(+" + droneGain.ToString("0") + ")";
            if (System.Math.Round(droneData.CurrentDronesPoints, 1) > System.Math.Round(DronePoints, 1))
            {
                Drone.color = Color.green;
            }
            else if (System.Math.Round(droneData.CurrentDronesPoints, 1) < System.Math.Round(DronePoints, 1))
            {
                Drone.color = Color.red;
            }
            else
            {
                TimerManager.Instance.AddTimer(() => { Drone.color = Color.white; }, 0.1f);
            }

            #region AI Calculate Fitness Score
            float currentHealth = aiFitnessScore.fillAmount;
            float health        = SDGManager.CalculateHealth();

            if (!inLerp)
            {
                StartCoroutine(LerpHealth(1, currentHealth, health, aiFitnessScore));
            }

            if (!SDGManager.SDGBar[2].LockImage[0].gameObject.activeInHierarchy)
            {
                performanceData.CalculatePerformance(health);
            }

            if (health == 0 && !SDGManager.SDGBar[2].LockImage[0].gameObject.activeInHierarchy)
            {
                dateTimer.EndDate();
            }

            #endregion
            if ((UpgradeAbilities.TEMPALLOCATIONPOOL > 0 || !TurnManager.ISINTERACTABLE) && !inProces)
            {
                turnButton.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Unspend -";
                turnButton.transform.GetChild(1).gameObject.SetActive(true);
                turnButton.interactable = false;
            }
            else
            {
                turnButton.interactable = true;
                turnButton.transform.GetChild(1).gameObject.SetActive(false);
                turnButton.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "End Week";
            }
            if (inProces && !TurnManager.ISINTERACTABLE)
            {
                turnButton.interactable = false;
                turnButton.transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = "Processing";
            }



            #region AI Trust
            if (((svDisapproveSlider.value != SvDisapprovesPercentage) || ((svNeutralSlider.value) != (SvDisapprovesPercentage + SvNeutralPercentage))) && !lerpSV)
            {
                StartCoroutine(LerpSVPercentage(1, SvDisapprovesPercentage, (SvDisapprovesPercentage + SvNeutralPercentage)));
            }

            svDisapprovePercentageTMP.text = (SvDisapprovesPercentage * 100).ToString("0.0") + "%";
            svNeutralPercentageTMP.text    = (SvNeutralPercentage * 100).ToString("0.0") + "%";
            svApprovePercentageTMP.text    = (SvApprovesPercentage * 100).ToString("0.0") + "%";

            if (((localDisapprovelSlider.value != LocalDisapprovesPercentage) || ((localNeutralSlider.value) != (LocalDisapprovesPercentage + LocalNeutralPercentage))) && !lerpLocal)
            {
                StartCoroutine(LerpLocalPercentage(1, LocalDisapprovesPercentage, (LocalNeutralPercentage + LocalDisapprovesPercentage)));
            }

            localDisapprovePercentageTMP.text = (SvDisapprovesPercentage * 100).ToString("0.0") + "%";
            localNeutralPercentageTMP.text    = (LocalNeutralPercentage * 100).ToString("0.0") + "%";
            localApprovesPercentageTMP.text   = (LocalApprovesPercentage * 100).ToString("0.0") + "%";
            #endregion
        }