예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <InteractableObject>() && other.GetComponent <InteractableObject>().isPickup) //Elixir de vie
        {
            InteractableObject incommingObject = other.GetComponent <InteractableObject>();
            if (incommingObject.d == InteractableObject.Description.Elixir && incommingObject.objectType == 0)
            {
                float healAmont = incommingObject.GetComponent <HealPotion>().HealAmmont;
                Player_Health.HealPlayer(healAmont);
            }
            Destroy(other.gameObject);
        }

        if (other.GetComponent <InteractableObject>() && other.GetComponent <InteractableObject>().isPickup) //Elixir de vie
        {
            InteractableObject incommingObject = other.GetComponent <InteractableObject>();
            if (incommingObject.d == InteractableObject.Description.Fruit)
            {
                float healAmont = incommingObject.GetComponent <HealPotion>().HealAmmont;
                Player_Health.HealPlayer(healAmont);
            }
            Destroy(other.gameObject);
        }
    }