示例#1
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);
        }
示例#2
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();
        }
示例#3
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);
        }
示例#4
0
 public Hit GetHitForce()
 {
     return(Hit.FromFullLife(HitForce));
 }
示例#5
0
 private static double getLongLife(Hit a)
 {
     return(a.value);
 }
示例#6
0
 public void UpdateText()
 {
     LifepointsText.text = Hit.FromFullLife(Life).ToString();
 }
示例#7
0
 private bool PlayerCanPay()
 {
     return(PlayerScript.Player.Money.GreaterThanOrEqual(Hit.FromFullLife(Costs)));
 }
示例#8
0
 public Hit GetClickHitForce()
 {
     return(Hit.FromFullLife(attackerTouch.Force));
 }
示例#9
0
 public void AddMoney(double money)
 {
     Money += Hit.FromFullLife(money, 4);
 }