25 lines
655 B
C#
25 lines
655 B
C#
using UnityEngine;
|
|
using Fusion;
|
|
|
|
using Fusion.Addons.ConnectionManagerAddon;
|
|
public class remover : NetworkBehaviour
|
|
{
|
|
public void OnCollisionEnter(Collision collision)
|
|
{
|
|
if (!gameObject.GetComponentInParent<BNG.Grabbable>().BeingHeld && collision.gameObject.tag.Equals("remover"))
|
|
{
|
|
Remove();
|
|
|
|
}
|
|
}
|
|
|
|
public void Remove(){
|
|
ConnectionManager.instance. PlaySound("remove",.4f);
|
|
print(ConnectionManager.instance.name);
|
|
print(Object);
|
|
if (Object)
|
|
ConnectionManager.instance.runner.Despawn( Object);
|
|
}
|
|
|
|
}
|