예제 #1
0
    void OnTriggerEnter(Collider other)
    {
        ID_Manager tempID_Manager = (ID_Manager)other.transform.root.GetComponent("ID_Manager");

        if (tempID_Manager == null)
        {
            return;
        }

        //make sure you aren't hitting self or hitting someone repeatedly
        for (int i = 0; i < ids.Count; i++)
        {
            if (tempID_Manager.ID == ids[i])
            {
                return;
            }
        }

        //make sure it's a player being hit
        PowerUpHit tempPowerUpHit = other.transform.root.gameObject.GetComponent <PowerUpHit>();

        if (!tempPowerUpHit)
        {
            return;
        }

        ids.Add(tempID_Manager.ID);

        //perform general hit
        tempPowerUpHit.GeneraliHit();
    }
예제 #2
0
    void OnTriggerEnter(Collider other)
    {
        //make it's the player being hit, and not their weapon or a projectile
        PowerUpHit tempPowerUpHit = other.transform.root.gameObject.GetComponent <PowerUpHit>();

        if (!tempPowerUpHit)
        {
            return;
        }

        //prevent you from hitting yourself with the ability
        ID_Manager tempID_Manager = (ID_Manager)other.transform.root.GetComponent("ID_Manager");

        if (tempID_Manager.ID == checkID)
        {
            return;
        }

        //general hit causes player to flip and halt movement for a moment
        tempPowerUpHit.GeneraliHit();
    }