private void Die() { die = true; DieEvent.Invoke(); dieSound.Play(); animator.SetTrigger("Die"); }
private void OnTriggerEnter(Collider other) { WinCondition winCondition = other.GetComponent <WinCondition>(); DieEvent dieEvent = other.GetComponent <DieEvent>(); ICoins iCoins = other.GetComponent <ICoins>(); if (other.tag == "Cannon") { cannonTriggered = other.gameObject; other.enabled = false; StuckOnCannon(); cannonTriggered.GetComponent <CannonParent>().mAnimator.SetTrigger("Entering"); OnProgressLvl(transform.position); } else if (dieEvent != null) { mCollider.enabled = false; transform.position = reference.position; transform.eulerAngles = reference.eulerAngles; dieEvent.CharacterDie(); m_Rigidbody.constraints = RigidbodyConstraints.FreezeAll; m_SpriteRenderer.enabled = false; } else if (winCondition != null) { winCondition.Win(m_Rigidbody); mCollider.enabled = false; m_SpriteRenderer.enabled = false; } else if (iCoins != null) { iCoins.CollectCoins(); } }
// Start is called before the first frame update void Start() { if (spawner != null) { this.DieEvent += spawner.OnMedkitPick; } }
public void Die() { if (DieEvent != null) { DieEvent.Invoke(this, new EventArgs()); } }
public void SetHp(float points) { Currenthealth = points; if (Currenthealth <= 0) { DieEvent?.Invoke(); } ChangeView(); }
public void Damage(float damage) { Currenthealth -= damage; if (Currenthealth <= 0) { DieEvent?.Invoke(); } ChangeHealthEvent?.Invoke(Currenthealth); }
public void Init() { board = FindObjectOfType <GameBoard>(); rb = GetComponent <Rigidbody2D>(); ren = GetComponent <SpriteRenderer>(); dieEvent = new DieEvent(); isDead = false; }
public void Damage(float value) { Hitpoints = Mathf.Max(0f, Hitpoints - value); HitpointsChangeEvent?.Invoke(Hitpoints); if (Hitpoints <= 0f) { DieEvent?.Invoke(); Kill(); } }
protected virtual void Die() { alive = false; DieEvent?.Invoke(this); #if DEBUG Debug.Log($"{this.GetInstanceID()} | {this.name} died."); #endif Destroy(this.gameObject); }
void onDeath(DieEvent e) { DOVirtual.DelayedCall(m_deathTime, () => { SoundSystem.instance.play(m_deathClip, 0.8f); gameObject.SetActive(true); GameInfos.paused = true; m_ennemyLabel.setText(GameInfos.killCount.ToString(), Color.white); m_levelLabel.setText((GameInfos.level + 1).ToString(), Color.white); }); }
public void Damage(float damage) { if (Currenthealth - damage <= 0) { DieEvent?.Invoke(); } else { PhotonView?.RPC("DamageRPC", RpcTarget.All, damage); } }
public void PureDamage(float value) { Hitpoints = Mathf.Max(0f, Hitpoints - value); ChangeEvent?.Invoke(Hitpoints); if (Hitpoints > 0f) { return; } DieEvent?.Invoke(); }
public void ElecticDamage(float value) { Hitpoints = Mathf.Max(0f, Hitpoints - (value - value * (ElecticResistance / 100))); ChangeEvent?.Invoke(Hitpoints); if (Hitpoints > 0f) { return; } DieEvent?.Invoke(); }
public void Damage(float value) { _health = Mathf.Max(0f, _health - value); ChangeHealthEvent?.Invoke(_health); if (_health > 0f) { return; } DieEvent?.Invoke(); }
public void FireDamage(float value) { Hitpoints = Mathf.Max(0f, Hitpoints - (value - value * (FireResistance / 100))); StartCoroutine(TickDamageRoutine(value)); ChangeEvent?.Invoke(Hitpoints); if (Hitpoints > 0f) { return; } DieEvent?.Invoke(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag(ground)) { isOnGround = true; playerAnimator.SetBool("IsJumping", false); playerAnimator.SetBool("IsRunning", true); } else if (collision.gameObject.CompareTag(enemy)) { DieEvent?.Invoke(); gameObject.SetActive(false); } }
private IEnumerator TickDamageRoutine(float damageValue) { { yield return(new WaitForSeconds(1)); for (int i = _timer; i > 0; i--) { Hitpoints -= (damageValue * 0.05f); if (Hitpoints <= 0) { DieEvent?.Invoke(); } yield return(new WaitForSeconds(1)); } } }
void onDie(DieEvent e) { if (m_dead) { return; } m_dead = true; DOVirtual.DelayedCall(m_timeBeforeEndMessage, () => { Event <PlaySoundEvent> .Broadcast(new PlaySoundEvent(m_looseClip)); m_dieMessage.SetActive(true); }); DOVirtual.DelayedCall(m_timeBeforeBackLobby, () => SceneSystem.changeScene(m_lobbyName)); States.instance.deaths++; }
public void Die() { if (isPlayer) { Debug.LogWarning("GAME OVER!"); this.transform.position = spawnPoint.position; Spawner.SCORE_POINTS = 0; currentHealth = maxHealth; } else { DieEvent?.Invoke(this.gameObject); GameObject go = GameObject.Instantiate(shutteredCapsule); go.transform.position = this.transform.position; Destroy(this.gameObject); } }
public void ShowReviveVideo() { if (lifeVideo.IsLoaded()) { lifeVideo.Show(); } else { RequestLifeVideo(); } //TEST RESPAWN IN GAME DieEvent.DesactivatePanel(); Will.will.cannonTriggered.GetComponent <CannonParent>().Reactivate(); StartCoroutine(IGLevelManager.countDownHandler()); }
public void IceDamage(float value) { Hitpoints = Mathf.Max(0f, Hitpoints - (value - value * (IceResistance / 100))); var movement = GetComponentInParent <Movement>(); if (movement.Speed > 0) { movement.SetSpeed(movement.Speed - (movement.Speed * 0.1f)); } ChangeEvent?.Invoke(Hitpoints); if (Hitpoints > 0f) { return; } DieEvent?.Invoke(); }
private void OnMouseDown() { if (!_isFreezed) { clicksToDestroy--; HitEvent?.Invoke(); if (clicksToDestroy <= 0) { gameProxy.AddScore(score); DieEvent?.Invoke(); explodable.generateFragments(); foreach (var fragment in explodable.fragments) { fragment.AddComponent <ObjectCleaner>(); } gameProxy.AddTime(timeAddedOnDestroy); gameProxy.ExplosionForce.doExplosion(transform.position); explodable.explode(); } } }
void AlreadyInRespawnCannon() { DieEvent.ReactivateCollider(); switch (cannonTriggered.GetComponent <CannonParent>().cannonType) { case CannonType.staticCannon: StartCoroutine(cannonTriggered.GetComponent <StaticCannon>().Wick()); break; case CannonType.targetCannon: StartCoroutine(cannonTriggered.GetComponent <HAndV>().Move()); StartCoroutine(cannonTriggered.GetComponent <HAndV>().Wick()); break; case CannonType.rotatingCannon: StartCoroutine(cannonTriggered.GetComponent <RotatingCannon>().CannonRotate()); StartCoroutine(cannonTriggered.GetComponent <RotatingCannon>().Wick()); break; } revive = false; }
public bool Hit(IEnumerable <ContactPoint2D> contactPoints) { var topHit = true; foreach (var contact in contactPoints) { if (Vector2.Dot(contact.normal, Vector2.up) < 0.7f) { topHit = false; break; } } if (topHit) { Collider.enabled = false; DieEvent?.Invoke(); PlayDeathSound(); Animator.SetTrigger(Die1); } return(topHit); }
public void Die(Transform visualTransform = null) { IsDead = true; if (questId > 0) { NpcInteractableEvent?.Invoke(questId); } DieEvent?.Invoke(this); if (visualTransform != null) { var chest = Instantiate(chestInWorld, visualTransform.position, quaternion.identity); foreach (var item in DropItems) { chest.itemProps.Add(new ItemProp { item = item.item.GetCopy(), amount = item.amount }); } chest.PopUp(visualTransform.position); } IncomeEvent?.Invoke(Income); gameObject.SetActive(!IsDead); }
void onDie(DieEvent e) { m_died = true; }
public void Die() { Push(); DieEvent?.Invoke(this); }
void Die() { DieEvent?.Invoke(); Destroy(gameObject); }
private void Dead() { DieEvent?.Invoke(parametersSO.team); Destroy(this); }
private void OnRevivePlayer(object sender, EventArgs args) { DieEvent.DesactivatePanel(); Will.will.cannonTriggered.GetComponent <CannonParent>().Reactivate(); StartCoroutine(IGLevelManager.countDownHandler()); }