35 lines
685 B
C#
35 lines
685 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using MLAPI.Messaging;
|
|
|
|
public class HealthPickup : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
[ServerRpc]
|
|
void OnTriggerEnter(Collider collider)
|
|
{
|
|
if (collider.tag == "Player")
|
|
{
|
|
gameObject.SetActive(false);
|
|
|
|
var player = collider.GetComponent<PlayerHealth>();
|
|
|
|
if (player != null)
|
|
{
|
|
player.Heal(10f);
|
|
}
|
|
}
|
|
}
|
|
}
|