Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
35
Assets/Scripts/HealthPickup.cs
Normal file
35
Assets/Scripts/HealthPickup.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue