Example #1
0
    void OnTargetHit()
    {
        // the target could already be dead.. check..
        if (target != null && target.gameObject.activeInHierarchy)
        {
            BaseGameEntity targetEntity = target.GetComponent <BaseGameEntity>();
            targetEntity.DecreaseHp(cur_damage);

            if (particalPrefab != null)
            {
                GameObject partical = Instantiate <GameObject>(particalPrefab);
                partical.transform.position = target.transform.position;

                SmartParticle sp = partical.GetComponent <SmartParticle>();
                if (sp != null)
                {
                    sp.StickToTarget(target);
                }
            }

            if (isBufferUsed)
            {
                targetEntity.RegisterBuffer(buffer);
            }
        }
        EntityManager.S.ReturnEntity(this);
    }
Example #2
0
    public override void OnTriggerEnter_FromCollider(BaseGameEntity target)
    {
        // the target could already be dead.. check..
        if (target.gameObject.activeInHierarchy)
        {
            if (collidedList.Contains(target) == false)
            {
                collidedList.Add(target);
                target.DecreaseHp(cur_damage);

                if (isBufferUsed)
                {
                    target.RegisterBuffer(buffer);
                }
            }

            if (curCollidingList.Contains(target) == false)
            {
                curCollidingList.Add(target);
            }
        }
    }