DeltaVR/Assets/TreasureObject.cs
2022-06-29 14:45:17 +03:00

36 lines
765 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class TreasureObject : MonoBehaviourPunCallbacks
{
public TreasureHunt controller;
public CollectionTray tray;
public int row;
[PunRPC]
private void Collected()
{
//controller.addTotal();
tray.RowShow(row);
GetComponent<Renderer>().enabled = false;
GetComponent<BoxCollider>().enabled = false;
//Destroy(gameObject);
}
public void CollectedPun()
{
photonView.RPC("Collected", RpcTarget.AllBuffered);
}
private void OnTriggerEnter(Collider other)
{
if (other.transform.CompareTag("MenuHand"))
{
CollectedPun();
}
}
}