johnnygoodguy2000

HealthCollectableBehavior.cs

Dec 25th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | Gaming | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class HealthCollectableBehavior : MonoBehaviour, ICollectableBehavior
  6. {
  7.    [SerializeField] private float healthAmount;
  8.  
  9.    public void OnCollected(GameObject player)
  10.    {
  11.       // Adds health to the player
  12.       player.GetComponent<HealthController>().AddHealth(healthAmount);
  13.    }
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment