예제 #1
0
	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;
			}
		}
	}
예제 #2
0
    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);
	}
예제 #4
0
	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");
	}
예제 #6
0
	private void OnEntityDiedEvent(EntityDiedEvent evt)
	{
		if(evt.Entity.HasTag("Enemy"))
		{
			numKills++;

			string suffix = numKills == 1 ? "KILL" : "KILLS";			
			text_kills.text = numKills + " " + suffix;
		}
	}