private IEnumerator ExplodeAndDie() { if (Linking.Count > 0) { for (int i = 0; i < Linking.Count; i++) { ExplosionManager.SpawnExplosion(Linking[i].Coordinates); yield return(new WaitForSeconds(0.07f)); } SetCurrentVertex(Linking.First()); } else { ExplosionManager.SpawnExplosion(transform.position); yield return(new WaitForSeconds(0.1f)); } if (CurrentLine != null) { Destroy(CurrentLine.gameObject); } CurrentLine = null; Linking.Clear(); _isDying = false; PlayerDied?.Invoke(); }
public static void HandleData(GetDataEventArgs args, MemoryStream data, PvPPlayer player) { switch (args.MsgID) { case PacketTypes.PlayerHurtV2: PlayerHurt?.Invoke(typeof(DataHandler), new PlayerHurtArgs(args, data, player)); return; case PacketTypes.TogglePvp: PvPToggled?.Invoke(typeof(DataHandler), new TogglePvPArgs(player)); return; case PacketTypes.PlayerSlot: PlayerSlotUpdated?.Invoke(typeof(DataHandler), new PlayerSlotArgs(data, player)); return; case PacketTypes.PlayerDeathV2: PlayerDied?.Invoke(typeof(DataHandler), new PlayerDeathArgs(player)); return; case PacketTypes.ProjectileNew: ProjectileNew?.Invoke(typeof(DataHandler), new ProjectileNewArgs(args, data, player)); return; case PacketTypes.ProjectileDestroy: ProjectileDestroyed?.Invoke(typeof(DataHandler), new ProjectileDestroyArgs(data)); return; case PacketTypes.PlayerUpdate: PlayerUpdated?.Invoke(typeof(DataHandler), new PlayerUpdateArgs(data, player)); return; } }
void FlagLevelLoad() { if (Time.time > this.startTime + player.deathTime) { PlayerDied.Invoke(); } }
public static void OnPlayerDied(Player player) { if (PlayerDied != null) { PlayerDied.Invoke(player); } }
public void Die() { PlayerDied?.Invoke(); Destroy(gameObject); int deaths = PlayerPrefs.GetInt("Deaths"); PlayerPrefs.SetInt("Deaths", deaths + 1); }
public void ApplyDamage(int damage) { Lifes -= damage; if (Lifes <= 0) { PlayerDied?.Invoke(); } }
private void OnPlayerDie() { _player.Died -= OnPlayerDie; _isDied = true; _spawnDelay = SpawnDelay; PlayerDied?.Invoke(); }
public virtual void Die() { GameManager.instance.screenUIController.gameResultUIController.ShowGameResultUI(false); GameManager.instance.screenUIController.playerUIController.OnDisable(); PlayerDied?.Invoke(this); contactCollider.enabled = false; AnimationController.SetAnimationParameter(PlayerAnimatorParameter.Die); //AnimationController.SetDie(); }
void Update() { Camera camera = Camera.main; Vector3 position = camera.ViewportToWorldPoint(new Vector3(0, 0, camera.nearClipPlane)); if (transform.position.y < position.y) { PlayerDied?.Invoke(); } }
public void ApplyDamage(int damage) { _currentHealth -= damage; if (_currentHealth <= 0) { _animator.Play("Die"); PlayerDied?.Invoke(); } }
public GameEvents() { // Register a wrapper function to EntityDied which forwards player deaths to the more specific "PlayerDied" // (PlayerDied should never be directly invoked) EntityDied += (data) => { if (data.DeadEntity.Type == Entity.EntityType.Player) { PlayerDied?.Invoke(data); } }; }
private void TakeDamageFrom(Player player) { VerifyIsNotDead(); HitPoints -= player.AttackPower; if (IsDead) { PlayerDied?.Invoke(this); } }
/// <summary> /// Called when hit by a bomb /// </summary> /// <param name="collision">an object that collided with player</param> void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Bomb")) { // Destroy bomb and player Destroy(collision.gameObject); Destroy(gameObject); // Invoke player died event playerDied.Invoke(); } }
public void TakeDamage(int damage) { _audioSource.clip = _hurtSound; _audioSource.Play(); _currentHealth -= damage; HealthChanged?.Invoke(_currentHealth, _health); if (_currentHealth <= 0) { PlayerDied?.Invoke(); gameObject.SetActive(false); } }
public void TakeDamage(int damage) { _animator.SetTrigger("TakeDamage"); _audioSource.Play(); _currentHealth -= damage; HealthChanged?.Invoke(_currentHealth, _health); if (_currentHealth <= 0) { gameObject.SetActive(false); PlayerDied?.Invoke(); } }
void Death() { // Set the death flag so this function won't be called again. isDead = true; // Turn off any remaining shooting effects. playerShooting.DisableEffects(); // Turn off the movement and shooting scripts. playerMovement.enabled = false; playerShooting.enabled = false; if (PlayerDied != null) { PlayerDied.Invoke(); } }
public void TakeDamage(float damageAmount) { health -= damageAmount; health = health > maxHealth ? maxHealth : health; // make sure health doesn't exceed max if (isPlayer) { PlayerTakeDamage.Invoke(health); } if (health <= 0) { if (isPlayer) { PlayerDied.Invoke(); } } }
public void TakeDamage() { Debug.Log("Player " + playerNumber + " Taking damage!"); hitAudioSource.Play(); IsAlive = false; //disable player rigidbody and colliders //this way they fall over and off the map //also doesnt allow multiple damage to be taken playerRigidbody2D.constraints = RigidbodyConstraints2D.None; playerBoxCollider2D.enabled = false; playerCircleCollider2D.enabled = false; if (PlayerDied != null) { PlayerDied.Invoke(this); } }
public static void FireEventsFromMessage(Message message) { switch (message.Id) { case Messages.IngameBotStart: IngameBotStart?.Invoke(); return; case Messages.AreaChanged: AreaChanged?.Invoke(null, new AreaChangedArgs(message)); return; case Messages.CombatAreaChanged: CombatAreaChanged?.Invoke(null, new AreaChangedArgs(message)); return; case Messages.PlayerDied: PlayerDied?.Invoke(message.GetInput <int>()); return; case Messages.PlayerResurrected: PlayerResurrected?.Invoke(); return; case Messages.PlayerLeveled: PlayerLeveled?.Invoke(message.GetInput <int>()); return; case Messages.ItemLootedEvent: ItemLootedEvent?.Invoke(message.GetInput <CachedItem>()); return; case Messages.ItemStashedEvent: ItemStashedEvent?.Invoke(message.GetInput <CachedItem>()); return; case Messages.ItemsSoldEvent: ItemsSoldEvent?.Invoke(null, new ItemsSoldArgs(message)); return; } }
public void Die(string sourceID) { if (getStatus == PlayerStatus.Dead) { return; } else if (getStatus == PlayerStatus.Alive) { if (GameManager.instance.isRoyale) { if (isServer) { RoyaleManager.PlayerDied(netId.ToString()); } Zombify(); } } getStatus = PlayerStatus.Dead; if (isServer && playerDied != null) { playerDied.Invoke(); } // Show kill feed event if (!isServer) { GameManager.instance.onPlayerKilledCallback.Invoke(username, sourceID); } DisableComponents(); // Activate death screen if (isLocalPlayer) { GetComponent <PlayerComponents>().playerUIInstance.deathScreen.SetActive(true); } StartCoroutine(Respawn()); }
public void PlayerDeath() { PlayerDied?.Invoke(); Destroy(gameObject); }
public static void CallPlayerDied() { PlayerDied?.Invoke(); }
private void OnDeath() { animator.SetTrigger("Death"); PlayerDied?.Invoke(); }
//BROADCASTER METHODS //Call to broadcast event public static void NotifyPlayerDied() { PlayerDied?.Invoke(); }
private void IAmKilled(int id) { _Players.First(p => p.Player.Id == id).Death = true; PlayerDied?.Invoke(new DeathArguments(id)); }
private void Die() { PlayerDied?.Invoke(); }
public void CallPlayerDied(GameObject go) { PlayerDied?.Invoke(go); }
protected virtual void OnPlayerDied() => PlayerDied?.Invoke(this, EventArgs.Empty);
public static void OnPlayerDied() { PlayerDied?.Invoke(); }
protected virtual void OnPlayerDied() { PlayerDied?.Invoke(this, new PlayerEventArgs()); }