public void CalculateStrength()
    {
        _strength = (UpgradesController.Instance.UpgradesDictionary[Upgrade.Upgrade1] + 1) *
                    UpgradesController.CalculateMultiplier(Upgrade.Upgrade1);
        _strength += _strength * _prestigeCrystals * _prestigeCrystalsMultiplier;

        UpdateMiningPowerText();
    }
示例#2
0
    public void Init()
    {
        GameObject clickmesh = GameObject.Find("Clickmesh");

        speed    = clickmesh.GetComponent <Speed>();
        upgrades = clickmesh.GetComponent <Upgrades>();
        upgrades.Init();
        upgradesController = clickmesh.GetComponent <UpgradesController>();
        upgradesController.Init();
        boost        = clickmesh.GetComponent <Boost>();
        eventObjects = GameObject.Find("/Game").GetComponent <AutoSaver> ().eventManager.eventObjects;
    }
 private void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
示例#4
0
    private void UpdateText()
    {
        var prestigeBonus = GameController.Instance.GetPrestigeCrystals() *
                            GameController.Instance.GetPrestigeCrystalsMultiplier();

        var productivity = _upgradeValues.Productivity * UpgradesController.CalculateMultiplier(Upgrade);

        productivity += productivity * prestigeBonus;

        if (Upgrade.Equals(Upgrade.Upgrade1))
        {
            var strength = GameController.Instance.GetStrength();

            UpgradeDescription.text =
                "Increases <b>DMG</b> by <b>" + MoneyConverter.ConvertNumber(productivity) + "</b>.";
            ActualProductivity.text = "Current <b>DMG</b> is <b>" + MoneyConverter.ConvertNumber(strength) + "</b>.";

            if (!UpgradesController.Instance.UpgradesDictionary.ContainsKey(Upgrade))
            {
                return;
            }

            NextMultiplier.text =
                "x" + UpgradesController.GetClosestMultiplier(Upgrade);
        }
        else if (Upgrade.Equals(Upgrade.Upgrade2))
        {
            UpgradeDescription.text = "Shortens auto mining interval by <b>" + _upgradeValues.Productivity + "s</b>.";
            ActualProductivity.text =
                "Current mining interval is <b>" + GameController.Instance.GetMiningSpeed() + "s</b>.";
            NextMultiplier.text = "";
        }
        else
        {
            var autoStrength = UpgradesController.CalculateUpgradeProductivity(Upgrade);
            autoStrength += autoStrength * prestigeBonus;

            UpgradeDescription.text =
                "Increases <b>DPS</b> by <b>" + MoneyConverter.ConvertNumber(productivity) + "</b>.";
            ActualProductivity.text =
                "Current <b>DPS</b> is <b>" + MoneyConverter.ConvertNumber(autoStrength) + "</b>.";

            if (!UpgradesController.Instance.UpgradesDictionary.ContainsKey(Upgrade))
            {
                return;
            }

            NextMultiplier.text =
                "x" + UpgradesController.GetClosestMultiplier(Upgrade);
        }
    }
示例#5
0
    void Start()
    {
        UpgradesController            = new UpgradesController();
        BonusDictionary               = new BonusDictionary();
        PreBonusActiveIncome          = ActiveIncome;
        PreBonusPassiveIncome         = PassiveIncome;
        PreBonusPassiveIncomeInterval = PassiveIncomeInterval;

        UpgradesController.InitializeUpdatesCount();
        UpgradesController.SetNextActiveIncomeUpgradeCost(ActiveIncome);
        UpgradesController.SetNextPassiveIncomeUpgradeCost();
        UpgradesController.SetNextPassiveIncomeIntervalUpgradeCost();

        UpdateAllTexts();

        StartPassiveIncomeCoroutine();
    }
    public void CalculateAutoStrength()
    {
        double autoStrength = 0;

        foreach (var upgrade in UpgradesController.Instance.UpgradesDictionary.Keys)
        {
            if (!upgrade.Equals(Upgrade.Upgrade1) && !upgrade.Equals(Upgrade.Upgrade2))
            {
                if (UpgradesConsts.GetUpgradeValues(upgrade) != null)
                {
                    autoStrength += UpgradesConsts.GetUpgradeValues(upgrade).Productivity *
                                    UpgradesController.Instance.UpgradesDictionary[upgrade] *
                                    UpgradesController.CalculateMultiplier(upgrade);
                }
            }
        }

        autoStrength += autoStrength * _prestigeCrystals * _prestigeCrystalsMultiplier;

        _autoStrength = autoStrength;

        UpdateMiningPowerText();
    }
示例#7
0
        public void Setup(RectTransform healthUI, GameStateInfo info)
        {
            playerInfo = info;
            UpgradesController u = UpgradesController.Instance;

            healthMax     = u.GetHealthValue(info.levelHealth);
            healthCurrent = healthMax;
            this.healthUI = healthUI;
            movementSpeed = u.GetMovementValue(info.levelMovementSpeed);
            bullet.AdjustFireRate(u.GetFireRateValue(info.levelFireRate));
            //create object pool for bullets
            bullet.Setup();

            //NEW INPUT SYSTEM
            input = new Input_Gameplay();

            input.GamePlay.Exit.performed += (ctx) =>
            {
                //temporary so player can exit level
                DEATH();
            };

            input.GamePlay.Move.performed += (ctx) =>
            {
                velocity = (transform.forward * ctx.ReadValue <Vector2>().y + transform.right * ctx.ReadValue <Vector2>().x).normalized;
            };
            input.GamePlay.Aim.performed += (ctx) =>
            {
                local = (transform.forward * ctx.ReadValue <Vector2>().y + transform.right * ctx.ReadValue <Vector2>().x).normalized;
                //Debug.Log($"<color==green>Hello World!!</color>");
            };
            input.GamePlay.AimMouse.performed += (ctx) =>
            {
                Debug.Log($"<color=white>{ctx.ReadValue<Vector2>()}</color>");
                Vector2 dir = (ctx.ReadValue <Vector2>() - new Vector2(Screen.width / 2f, Screen.height / 2f)).normalized;
                local = (transform.forward * dir.y + transform.right * dir.x).normalized;
            };
            input.GamePlay.Fire.started += (ctx) =>
            {
                bullet.BeginFire(body);
            };
            input.GamePlay.Fire.canceled += (ctx) =>
            {
                bullet.StopFire();
            };

            input.GamePlay.Enable();


            //set values
            map = GameController.Instance.GetMap().transform;
            //sketchy...
            transform.position = map.GetChild(0).transform.position;
            mapLayer           = GameController.Instance.GetMapLayer();
            obstacleLayer      = GameController.Instance.GetObstacleLayer();


            //make sure player is setup correctly
            RaycastHit hit;

            if (Physics.Raycast(transform.position, (map.position - transform.position).normalized, out hit, float.PositiveInfinity, mapLayer))
            {
                transform.position = hit.point + hit.normal;
                transform.rotation = Quaternion.FromToRotation(transform.up, hit.normal) * transform.rotation;
            }
        }
示例#8
0
 void Start()
 {
     upgradesController = GetComponent <UpgradesController>();
     spawner            = GetComponent <Spawner>();
 }
示例#9
0
 private void Start()
 {
     costs = UpgradesController.Instance;
 }