public void FillBoost() { boost.ApplyChange(boostFillRate); if (boost.Value > 1) { boost.SetValue(1f); } }
public void TakeDamage(float damage) { currentHP.ApplyChange(-damage); if (IsDeath()) { currentHP.SetValue(0.0f); } }
public void ConsumeMP(float mana) { currentMP.ApplyChange(-mana); if (IsEmptyMana()) { currentMP.SetValue(0.0f); } }
void OnTriggerEnter2D(Collider2D collision) { if (Random.value > 0.25) { point.ApplyChange(1); } else { point.ApplyChange(2); } }
void EndMatch() { if (totalRuns > totalEnemyRuns) { m_result.text = "WIN!"; m_money.ApplyChange(3); m_fame.ApplyChange(3); } else if (totalRuns == totalEnemyRuns) { m_result.text = "DRAW"; //m_money.ApplyChange(m_fame.Value); } else { m_result.text = "LOST"; //m_money.ApplyChange(m_fame.Value); //m_fame.ApplyChange(-1); } for (int i = 0; i < m_orderManager.order.Length; i++) { m_orderManager.order[i].stats.Refresh(); } m_totalScores.ApplyChange(totalRuns); }
private void IncrementScore() { if (score != null) { score.ApplyChange(50); } }
/// <summary> /// Обновляем количество ХП у игрока /// </summary> /// <param name="value"></param> /// <param name="equalize"></param> private void ChangeHP(float value, bool equalize = false) { if (currentHP != null) { if (equalize) { currentHP.SetValue(value); } else { currentHP.ApplyChange(value); } } else { Debug.LogError("CurrentHP is null for @" + this.name); } if (hpValueChangedEvent != null) { hpValueChangedEvent.Raise(); } else { Debug.LogError("HPValueChangedEvent is null for @" + this.name); } }
private void CollectCoin() { if (scoreVariable != null && coinValue != null) { scoreVariable.ApplyChange(coinValue); } else { Debug.LogError("ScoreVariable or/and CoinValue is null for " + this.name); } if (coinCollectedEvent != null) { coinCollectedEvent.Raise(); } else { Debug.LogError("CoinCollectedEvent is null for " + this.name); } if (energizer) { if (energizerCollectedEvent != null) { energizerCollectedEvent.Raise(); } else { Debug.LogError("EnergizerCollectedEvent is null for " + this.name); } } this.gameObject.SetActive(false); }
public void AddScore() { float score = 100 * scoreMultiplier.GetValue(); totalScore.ApplyChange(score); currentScore.ApplyChange(score); }
public void scorePointsRespawn() { float pointsToAdd = levelTimeVar.Value * 2f; score.ApplyChange(pointsToAdd); resetTimer(); scorePoint.Invoke(); }
private IEnumerator InitiateDash(Vector2 inputAxis) { OnStartDash.Raise(); if (inputAxis == Vector2.zero) { inputAxis = Vector2.up; } m_Rigidbody.useGravity = false; m_Rigidbody.velocity = Vector3.zero; canDash.SetValue(false); isDashing.SetValue(true); m_Rigidbody.drag = dashDrag.Value; currentDashCooldown.SetValue(0); float currentDashDuration = 0; while (currentDashCooldown.Value <= dashDuration) { m_Rigidbody.velocity = inputAxis * dashSpeed.Value; currentDashCooldown.ApplyChange(Time.deltaTime); yield return(null); } OnFinishDash.Raise(); isDashing.SetValue(false); m_Rigidbody.velocity = m_Rigidbody.velocity.normalized * currentTargetSpeed.Value; while (currentDashCooldown.Value <= dashCooldown) { currentDashCooldown.ApplyChange(Time.deltaTime); yield return(null); } currentDashCooldown.SetValue(0); canDash.SetValue(true); OnFinishDashCD.Raise(); yield return(0); }
private void DealDamage(FloatReference damage) { HP.ApplyChange(-damage); if (HP.Value <= 0.0f) { DeathEvent.Invoke(); } }
IEnumerator count() { while (levelTimeVar.Value > -1) { levelTimeVar.ApplyChange(-1f); updateTimer.Invoke(); yield return(new WaitForSeconds(1f)); } }
public void looseLife() { lives.ApplyChange(-1f); looseLive.Invoke(); if (lives.Value <= 0f) { deathEvent.Invoke(); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player") && !enterThisField.Value) { points.ApplyChange(pointsEarned); scorePoints.Invoke(); enterThisField.setValue(true); } }
private void OnTriggerEnter(Collider other) { DamageDealer damage = other.gameObject.GetComponent <DamageDealer>(); if (damage != null) { HP.ApplyChange(-damage.DamageAmount); } }
private void OnTriggerEnter(Collider other) { PointIncrease point = other.gameObject.GetComponent <PointIncrease>(); if (point != null) { Points.ApplyChange(+point.PointAmount); PointAdd.Invoke(); Destroy(gameObject); } }
public void TakeDamage(float damage) { if (damage > 0) { HP.ApplyChange(-damage); OnPlayerDamagedEvent.Invoke(); } if (HP.Value <= 0) { OnPlayerDeathEvent.Invoke(); } }
public override void Exit() { base.Exit(); if (hasBroken) { scoreMultiplier.ApplyChange(multipliers.comboMultiplier); OnBreak?.Invoke(); } breakableList.Clear(); pendingBlocks.Clear(); }
private void OnTriggerEnter(Collider other) { ProjectileBase projectile = other.gameObject.GetComponent <ProjectileBase>(); currentHealth.ApplyChange(-projectile.DamageAmount); if (currentHealth.Value <= 0) { Debug.Log("The PLayer is Dead!"); Destroy(gameObject); } }
public void ConstantUpdate() { YearsPlayed.ApplyChange(Time.deltaTime); elapsedTime += Time.deltaTime; if (elapsedTime >= UpdateSeconds) { UpdateResourcesValue(); elapsedTime = 0; } }
private void HandleDamage(DamageDealer damage) { if (damage != null) { HP.ApplyChange(-damage.DamageAmount); DamageEvent.Invoke(); } if (HP.Value <= 0.0f) { DeathEvent.Invoke(); } }
// Update is called once per frame void FixedUpdate() { if (playerAlive.value == true) { if (Time.timeScale > 0f) { score.ApplyChange(Time.deltaTime * 100); } } else if (!visible) { GameOver(); } }
IEnumerator RegenResource() { while (currentValue.Value < startingValue.Value) { yield return(new WaitForSeconds(1f)); if (currentValue.Value >= startingValue.Value) { regenerating = false; } else { if (RegenRate != null) { currentValue.ApplyChange(RegenRate.Value); } else { currentValue.ApplyChange(0f); } } } }
private void OnTriggerEnter(Collider other) { DamageDeal damage = other.gameObject.GetComponent <DamageDeal>(); if (damage != null) { HP.ApplyChange(-damage.DamageAmount); DamageEvent.Invoke(); } if (HP.Value <= 0.0f) { DeathEvent.Invoke(); } }
void FixedUpdate() { if (playerAlive.value == true) { if (Time.timeScale > 0f) { score.ApplyChange(Time.deltaTime * 100); } } else if (visible != true) { GameOver(); pauseButton.transform.localScale = Vector3.zero; } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { timesLevelIsComplete.ApplyChange(1f); if (timesLevelIsComplete.Value >= 3) { completeLevel.Invoke(); } else { respawn.Invoke(); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.GetComponent <CarController>()) { if (trialsDone.Value >= maxTrials.Value) { TrainingHandler.Instance.GoToMainExperiment(); _resetPosition = respawnPointTrialFailed.transform; } ResetCar(other.gameObject); trialsDone.ApplyChange(1); StartCoroutine(TakeAwayControl(other)); } }
/// <summary> /// Проверяем окончен ли уроень /// </summary> private void EndLvlController() { if (activeCoinsSet.Items.Count <= 0) { gameOver = true; currentLvl.ApplyChange(+1); if (updateLVLEvent != null) { updateLVLEvent.Raise(); } else { Debug.LogError("UpdateLVLEvent is null for @" + this.name); } StartLvl(); } }
/// <summary> /// Takes the damage. /// </summary> /// <returns>The damage really taken.</returns> /// <param name="damage">Damage.</param> public float TakeDamage(float damage) { if (Time.time > nextTime) { HP.ApplyChange(-damage); nextTime = Time.time + invincibleTime; Debug.Log("apply health change " + Time.time + ", " + nextTime); if (HP.Value <= 0.0f) { DeathEvent.Invoke(); } return(damage); } else { return(0); } }