예제 #1
0
    void checkifhit(Collider c)
    {
        if (!entitiesHit.Contains(c.transform.root.gameObject))
        {
            //add them to the list
            entitiesHit.Add(c.transform.root.gameObject);

            //check sibling index to see if we hit head, body or legs

            if (c.transform.GetSiblingIndex() == 0)
            {
                //        Debug.Log("Hit head");
                damage = 3;
            }
            else if (c.transform.GetSiblingIndex() <= 2)
            {
                //      Debug.Log("Hit Body");
                damage = 2;
            }
            else
            {
                //    Debug.Log("hit legs");
                damage = 1;
            }

            ctrl          = c.transform.root.GetComponent <AttackController>();
            ctrl.enemyRef = this;
            ctrl.HandleBlocks((attacktype() + damage + damageCalculator()) * 10f);
            empty = false;
            return;
        }
        empty = true;
    }