Ejemplo n.º 1
0
    private void OnEnemyDeath(OnDeathArgs args)
    {
        Characteristics c = args.source.GetComponent <Characteristics>();

        if (c != null)
        {
            c.Experience += xp;
        }

        StartCoroutine("CheckInventoryEmpty");
    }
Ejemplo n.º 2
0
    private void OnDeath(OnDeathArgs e)
    {
        isAlive = false;
        animator.SetBool("isAlive", isAlive);
        target           = null;
        audioSource.clip = deathSound;
        audioSource.Play();
        EventHandler <OnDeathArgs> handler = Death;

        if (handler != null)
        {
            handler(this, e);
        }
    }
Ejemplo n.º 3
0
 static DeathEvent()
 {
     if (loaded)
     {
         return;
     }
     loaded       = true;
     Game.OnTick += delegate
     {
         foreach (var obj in ObjectManager.Get <GameObject>().Where(o => o.IsValid))
         {
             if (obj != null)
             {
                 var netid = obj.NetworkId;
                 if (obj.IsDead)
                 {
                     if (!invoked.ContainsKey(netid))
                     {
                         var args = new OnDeathArgs
                         {
                             Sender   = obj, StartTick = Core.GameTickCount,
                             EndTick  = obj.IsChampion() ? ((Game.Time + ((AIHeroClient)obj).DeathDuration()) * 1000f) : int.MaxValue,
                             Duration = obj.IsChampion() ? (((AIHeroClient)obj).DeathDuration() * 1000f) : int.MaxValue,
                         };
                         invoked.Add(netid, args);
                         OnDeath?.Invoke(args);
                     }
                 }
                 else
                 {
                     if (invoked.ContainsKey(netid))
                     {
                         invoked.Remove(netid);
                     }
                 }
             }
         }
     };
 }
    private void OnDeath(OnDeathArgs args)
    {
        foreach (var i in items)
        {
            if (i.obj == null)
            {
                return;
            }

            if (i.obj is MonoBehaviour)
            {
                MonoBehaviour b = i.obj as MonoBehaviour;
                b.enabled = i.state;
            }
            else if (i.obj is Collider)
            {
                Collider c = i.obj as Collider;
                c.enabled = i.state;
            }
            else if (i.obj is GameObject)
            {
                GameObject go = i.obj as GameObject;
                go.SetActive(i.state);
            }
            else
            {
                Debug.LogError(i.obj.name + " can't be handled by this script.");
            }
        }

        Animator anim = GetComponent <Animator>();

        if (anim != null)
        {
            anim.SetTrigger(deathTriggerName);
        }
    }
Ejemplo n.º 5
0
 private void Target_Death(object sender, OnDeathArgs e)
 {
     target = null;
     OnKilledTarget();
 }
Ejemplo n.º 6
0
 private void OnDeathCallback(OnDeathArgs args)
 {
     //print message like "World Killed you!!" with args.source.getName()
     GetComponent <Renderer>().material.color = Color.red;
     //Destroy(gameObject);
 }
Ejemplo n.º 7
0
 private void PlayerDie(OnDeathArgs args)
 {
     Camera.main.GetComponent <GameCamera>().enabled = false;
     youDiePanel.gameObject.SetActive(true);
     menuInGame.enabled = false;
 }