示例#1
0
    void OnTriggerEnter(Collider collider)
    {
        if (_timeCount < .04f)
        {
            return;
        }

        Killable killable = collider.GetComponent <Killable> ();

        if (killable != null)
        {
            // If friendly fire, ignore
            if (!FactionRelationshipManager.IsHostile(_Owner._faction, killable._faction))
            {
                return;
            }
            //Create a hit spark particle and activate it
            HitSparks hs = ObjectPool.instance.GetHitSpark();
            if (hs != null)
            {
                hs.transform.position = t.position;
                hs.Live();
                //Rotate spark
                hs.transform.LookAt(_initPos);
            }

            //Cause damage
            killable.OnHit(_damage, _Owner);

            Destroy();
        }
    }
示例#2
0
    private void OnTriggerEnter(Collider collision)
    {
        if (timeCount < 1f)
        {
            return;
        }

        ExplosionObject explosion = ObjectPool.instance.GetExplosionObject();

        explosion.transform.position = transform.position;
        explosion.Live();

        Killable killable = Target.GetComponent <Killable> ();

        if (killable != null)
        {
            //Cause damage
            killable.OnHit(500, _Owner);
        }

        Destroy(gameObject);
    }