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