private void OnEntityDeathEvent(EntityDiedEvent evt) { Entity target = evt.Entity; // Reset if the player dies if(target.HasTag("Player")) { Amount = 0; } // Add currency if the target is an enemy else if(target.HasTag("Enemy") && evt.Damage.hit.source.HasTag("Player")) { string tag = evt.Damage.hit.tag; switch(tag) { case "Head": AddCurrency(250); break; default: AddCurrency(100); break; } } }
private void Start() { ResetMatch(); if (isServer) { EntityDiedEvent.AddListener(OnEntityDeath); } }
private void OnDead(EntityDiedEvent evt) { audioManager.PlayRandomAt(deathSounds, entity.transform.position); GameObject go = Instantiate(ragdoll, entity.transform.position, entity.transform.rotation) as GameObject; go.transform.SetParent(entity.transform.parent); Destroy(entity.gameObject); }
private void OnDamageReceived(WeaponDamageEvent evt) { if(!dead && health.CurrentHealth <= 0) { dead = true; EntityDiedEvent diedEvent = new EntityDiedEvent(evt.Damage, Entity); GlobalEvents.Invoke(diedEvent); Entity.Events.Invoke(diedEvent); // Mark the entity as dead Entity.AddTag("Dead"); } }
private void OnDead(EntityDiedEvent evt) { SceneManager.LoadScene("Menus"); }
private void OnEntityDiedEvent(EntityDiedEvent evt) { if(evt.Entity.HasTag("Enemy")) { numKills++; string suffix = numKills == 1 ? "KILL" : "KILLS"; text_kills.text = numKills + " " + suffix; } }