Пример #1
0
    void OnTriggerEnter(Collider other)
    {
        InteractionPrompt.Invoke(this.Interactables.Count > 0);

        switch (other.tag)
        {
        case "Enemy Weapon":
            if (isVulnerable)
            {
                this.SetState(new TakeDamageState(this));
                PlayerDamaged.Invoke();
            }
            break;

        case "Health":
            if (health < maxHealth)
            {
                health += 2;

                if (health > 10)
                {
                    health = 10;
                }

                HealthPickup.Invoke();
                Audio.PlayOneShot(healthPick);

                other.gameObject.SetActive(false);
            }
            break;
        }
    }
Пример #2
0
    void OnInteract(InputAction.CallbackContext context)
    {
        List <Interactable> interactablesToDispose = new List <Interactable>();

        foreach (Interactable interactable in this.Interactables)
        {
            if (interactable)
            {
                interactable.InteractionEvent();
                interactablesToDispose.Add(interactable);
            }
        }

        foreach (Interactable interactable in interactablesToDispose)
        {
            this.Interactables.Remove(interactable);
        }

        interactablesToDispose.Clear();

        InteractionPrompt.Invoke(this.Interactables.Count > 0);
        GoldPickup.Invoke();
    }
Пример #3
0
 void OnTriggerExit()
 {
     InteractionPrompt.Invoke(this.Interactables.Count > 0);
 }