Exemplo n.º 1
0
 private void UpdateText()
 {
     TitleTextObject.text = Titel;
     ForceTextObject.text = Hit.FromFullLife(Force).ToString();
     CostTextObject.text  = Hit.FromFullLife(Costs).ToString();
     IconImage.sprite     = Icon;
 }
Exemplo n.º 2
0
        private static Hit GetRemainingMoney()
        {
            var objects = GameObject.FindGameObjectsWithTag(BarrierScript.TAG);
            var scripts = objects.Select(bo => bo.GetComponent <BarrierScript>().Life);

            return(Hit.FromFullLife(scripts.Sum(l => l / 10000d) * 10000));
        }
Exemplo n.º 3
0
        void OnMouseLeftUp()
        {
            Debug.Log("PowerUp");

            if (!started)
            {
                PlayerScript.Player.Money -= Hit.FromFullLife(Costs);
                runtime = 0;
                Instance.MultiplierEffect = Multiplier;
                started = true;
            }
        }
Exemplo n.º 4
0
        void Start()
        {
            if (Instance == null)
            {
                Instance = new MultiplierInfo();
            }

            TitleText.text            = Title;
            IconImage.sprite          = Icon;
            CostText.text             = Hit.FromFullLife(Costs).ToString();
            button                    = GetComponent <Button>();
            Instance.MultiplierEffect = 1;
        }
Exemplo n.º 5
0
 void Start()
 {
     Money                = Hit.FromFullLife(InitMoney, 4);
     moneyFormat          = MoneyText.text;
     levelFormat          = LevelText.text;
     remainingMoneyFormat = RemainingMoneyText.text;
     clickTimeFormat      = ClickTime.text;
     highscoreFormat      = HighscoreText.text;
     highscoreTime        = TimeSpan.Zero;
     highscoreLevel       = 1;
     levelTime            = DateTime.Now;
     attackerTouch        = GameObject.FindGameObjectsWithTag(AttackerButtonScript.TAG).Select(bo => bo.GetComponent <AttackerButtonScript>()).FirstOrDefault(script => script.Titel.Equals("Touch"));
     UpdateTexts();
 }
Exemplo n.º 6
0
        void Update()
        {
            button.interactable = PlayerScript.Player.Money.GreaterThan(Hit.FromFullLife(Costs));

            if (spawnBall && ballScript == null && BallPrefab != null)
            {
                var spawnArea = GameScript.Game.Spawnarea;
                var bo        = SpawnHelper.TrySpawn(BallPrefab, spawnArea.transform.position, spawnArea.bounds.size, Quaternion.identity);
                if (bo != null)
                {
                    SpawnHelper.SetParentInHierarchy(bo, ballsSpawnParent);

                    //Debug.Log("Spawn Ball");
                    ballScript          = bo.GetComponent <BallScript>();
                    ballScript.HitForce = spawnBallForce;
                    ballScript.Speed    = Speed;
                    ballScript.Mass     = Mass;

                    spawnBall = false;
                }
            }

            PermanentEffect_FullUpgrade();
        }
Exemplo n.º 7
0
        private bool Upgrade()
        {
            var costs    = Hit.FromFullLife(Costs);
            var player   = PlayerScript.Player;
            var hasMoney = player.Money.GreaterThanOrEqual(costs);

            if (hasMoney)
            {
                player.Money -= costs;

                if (!IsTouchAttacker && IsSpawnRequired)
                {
                    // spawn in next update
                    spawnBall      = true;
                    spawnBallForce = Force;
                }

                UpgradeForce();

                UpgradeCosts();
            }

            return(hasMoney);
        }
Exemplo n.º 8
0
        public void DoDemage(Hit hit, bool showHitAnimation = true)
        {
            if (GameScript.Game.LoadingPanel.gameObject.activeSelf)
            {
                return;
            }

            //Debug.Log(string.Format("Hit BarrierScript: {0}", hit.FullLife));
            var remainingPower = Math.Max(1, hit.FullLife - Life);
            var h = Hit.FromFullLife(Life);

            h   -= hit;
            life = h.FullLife;
            UpdateLifeColorProgress();

            var hitAnimation = PlayAnim;

            if (hitAnimation != null && showHitAnimation)
            {
                hitAnimation.Play();
            }

            var destroy = h.IsZero;

            if (destroy)
            {
                // entfernen!
                //GetComponent<CircleCollider2D>().enabled = false;

                Explode(remainingPower);
            }

            PlayerScript.Player.AddMoney(remainingPower);

            NotifyHit(destroy);
        }
Exemplo n.º 9
0
 public Hit GetHitForce()
 {
     return(Hit.FromFullLife(HitForce));
 }
Exemplo n.º 10
0
 public void UpdateText()
 {
     LifepointsText.text = Hit.FromFullLife(Life).ToString();
 }
Exemplo n.º 11
0
 private bool PlayerCanPay()
 {
     return(PlayerScript.Player.Money.GreaterThanOrEqual(Hit.FromFullLife(Costs)));
 }
Exemplo n.º 12
0
 public Hit GetClickHitForce()
 {
     return(Hit.FromFullLife(attackerTouch.Force));
 }
Exemplo n.º 13
0
 public void AddMoney(double money)
 {
     Money += Hit.FromFullLife(money, 4);
 }