public override void OnStateEnter() { player.Anim.CrossFade("Male Die", 0.2f); PlayerDeath.Invoke(); player.isVulnerable = false; DisablePlayer(); }
/// <summary> /// Raises the player death event. /// </summary> private void OnPlayerDeath() { if (PlayerDeath != null) { PlayerDeath.Invoke(); } }
public void TakeDamage() { PlayerDeath?.Invoke(); _scriptableEventChannel.ShakeTheCamera?.Invoke(0.5f, 0.2f); Instantiate(_onDeathEffects, transform.position, Quaternion.identity); FMODUnity.RuntimeManager.PlayOneShot("event:/Character/Death"); Destroy(gameObject); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Enemy")) { if (PlayerDeath != null) { PlayerDeath.Invoke(); } } }
public static void HandleData(GetDataEventArgs args, MemoryStream data, PvPPlayer player) { switch (args.MsgID) { case PacketTypes.PlayerHurtV2: if (new PlayerHurtArgs().ExtractData(args, data, player, out var playerhurt)) { PlayerHurt?.Invoke(typeof(DataHandler), playerhurt); } return; case PacketTypes.TogglePvp: if (new TogglePvPArgs().ExtractData(player, out var togglepvp)) { PvPToggled?.Invoke(typeof(DataHandler), togglepvp); } return; case PacketTypes.PlayerSlot: if (new PlayerSlotArgs().ExtractData(data, player, out var playerslot)) { SlotUpdate?.Invoke(typeof(DataHandler), playerslot); } return; case PacketTypes.PlayerDeathV2: if (new PlayerDeathArgs().ExtractData(player, out var playerdeath)) { PlayerDeath?.Invoke(typeof(DataHandler), playerdeath); } return; case PacketTypes.ProjectileNew: if (new ProjectileNewArgs().ExtractData(args, data, player, out var projectilenew)) { ProjectileNew?.Invoke(typeof(DataHandler), projectilenew); } return; case PacketTypes.ProjectileDestroy: if (new ProjectileDestroyArgs().ExtractData(data, out var projectiledestroy)) { ProjectileDestroyed?.Invoke(typeof(DataHandler), projectiledestroy); } return; case PacketTypes.PlayerUpdate: if (new PlayerUpdateArgs().ExtractData(data, player, out var playerupdate)) { PlayerUpdate?.Invoke(typeof(DataHandler), playerupdate); } return; } }
public void DoDamage(double value) { Health -= value; if (Health <= 0) { Health = 0; PlayerDeath?.Invoke(); } else { StateChanged?.Invoke(); } }
protected virtual void OnPlayerDeath(PlayerDeath packet) { System.Diagnostics.Debug.Assert(PlayerId != null, nameof(PlayerId) + " != null"); if (packet.playerId == PlayerId.Value) { Players[PlayerId.Value].PlayerObject.Kill(); Debug.Log("Death!"); } Players[packet.playerId].Deaths = packet.playerDeaths; Players[packet.killerId].Kills = packet.killerKills; if (packet.killerId == PlayerId.Value) { OwnKill?.Invoke(this, Players[packet.playerId]); } Debug.LogFormat("Player {0} killed Player {1}", packet.killerId, packet.playerId); PlayerDeath?.Invoke(this, packet); }
private void OnTriggerEnter2D(Collider2D collision) { if (invulnerableTimeLeft > 0) { return; } AudioSource.Play(); Health--; Damage1SpriteRenderer.enabled = false; Damage2SpriteRenderer.enabled = Health == 2; Damage3SpriteRenderer.enabled = Health == 1; if (Health <= 0) { PlayerDeath?.Invoke(); } else { StartInvulerability(); } }
public static void InvokePlayerDeath(PlayerStats stats, ref PlayerStats.HitInfo info, GameObject obj, int pid = 0) { PlayerDeath playerDeath = PlayerDeathEvent; if (playerDeath == null) { return; } PlayerDeathEvent ev = new PlayerDeathEvent() { Killer = pid == 0 ? stats.gameObject.GetPlayer() : Player.GetPlayer(pid), Player = Player.GetPlayer(obj), Info = info }; if (string.IsNullOrEmpty(ev.Player.characterClassManager.UserId)) { return; } playerDeath?.Invoke(ref ev); info = ev.Info; }
public static void InvokePlayerDeath(PlayerDeathEventArgs e) { PlayerDeath?.Invoke(e); }
// ReSharper disable UnusedParameter.Local private void OnPlayerDeath(int oldValue, int newValue) { PlayerDeath?.Invoke(); }
public void OnPlayerDeath(int deathCount) { PlayerDeath?.Invoke(deathCount); }
public static void Kill() { //Invokes the playerdeath event PlayerDeath?.Invoke(typeof(PlayerLife), System.EventArgs.Empty); }
public static void InvokePlayerDeath(Mobile m) => PlayerDeath?.Invoke(m);
protected override IEnumerator Death() { PlayerDeath.Invoke(); yield return(null); }
public void OnPlayerDeath() { PlayerDeath?.Invoke(); }
public void ApplyDamage(DamageMessage data) { if (currentHitPoints <= 0) {//ignore damage if already dead. TODO : may have to change that if we want to detect hit on death... return; } if (isInvulnerable) { OnHitWhileInvulnerable.Invoke(); return; } Vector3 forward = transform.forward; forward = Quaternion.AngleAxis(hitForwardRotation, transform.up) * forward; //we project the direction to damager to the plane formed by the direction of damage Vector3 positionToDamager = data.damageSource - transform.position; positionToDamager -= transform.up * Vector3.Dot(transform.up, positionToDamager); if (Vector3.Angle(forward, positionToDamager) > hitAngle * 0.5f) { return; } isInvulnerable = true; currentHitPoints -= data.amount; if (currentHitPoints <= 0) { schedule += OnDeath.Invoke; //This avoid race condition when objects kill each other. if (this.gameObject.layer == 9) //Player { if (data.damager.gameObject.name == "BodyDamager") { PlayerDeathEvent?.Invoke(ENEMY_TYPE.CHOMPER); } else if (data.damager.gameObject.name == "Spit(Clone)") { PlayerDeathEvent?.Invoke(ENEMY_TYPE.SPITTER); } } else if (this.gameObject.layer == 23) // Enemy { if (gameObject.name == "Chomper") { EnemyDeathEvent?.Invoke(gameObject, ENEMY_TYPE.CHOMPER); } else if (gameObject.name == "Spitter") { EnemyDeathEvent?.Invoke(gameObject, ENEMY_TYPE.SPITTER); } } } else { if (data.damager.gameObject.name == "BodyDamager") { PlayerHurtEvent?.Invoke(ENEMY_TYPE.CHOMPER); } else if (data.damager.gameObject.name == "Spit(Clone)") { PlayerHurtEvent?.Invoke(ENEMY_TYPE.SPITTER); } OnReceiveDamage.Invoke(); } var messageType = currentHitPoints <= 0 ? MessageType.DEAD : MessageType.DAMAGED; for (var i = 0; i < onDamageMessageReceivers.Count; ++i) { var receiver = onDamageMessageReceivers[i] as IMessageReceiver; receiver.OnReceiveMessage(messageType, this, data); } }
//fires event of player loose public static void FirePlayerDeath() { PlayerDeath?.Invoke(); }
public void OnPlayerDeath() { Bot.Stats.Deaths++; PlayerDeath?.Invoke(Bot); }