Esempio n. 1
0
    public void ServerToggleCupboard()
    {
        if (IsClosed)
        {
            if (lockLight != null)
            {
                if (lockLight.IsLocked())
                {
                    IsLocked = false;
                    return;
                }

                IsClosed = false;
                SetItems(true);
            }
            else
            {
                IsClosed = false;
                SetItems(true);
            }
        }
        else
        {
            IsClosed = true;
            SetItems(false);
        }
    }
Esempio n. 2
0
        void OnMouseDown()
        {
            if (PlayerManager.PlayerScript != null)
            {
                var headingToPlayer = PlayerManager.PlayerScript.transform.position - transform.position;
                var distance        = headingToPlayer.magnitude;

                if (distance <= 2f)
                {
                    if (lockLight != null && lockLight.IsLocked())
                    {
                        photonView.RPC("LockLight", PhotonTargets.All);
                    }
                    else
                    {
                        if (IsClosed)
                        {
                            photonView.RPC("Open", PhotonTargets.All);
                        }
                        else if (!TryDropItem())
                        {
                            photonView.RPC("Close", PhotonTargets.All);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
    void OnMouseDown()
    {
        if (PlayerManager.control.playerScript != null)
        {
            var headingToPlayer = PlayerManager.control.playerScript.transform.position - transform.position;
            var distance        = headingToPlayer.magnitude;

            if (distance <= 2f)
            {
                if (lockLight != null && lockLight.IsLocked())
                {
                    lockLight.Unlock();
                }
                else
                {
                    SoundManager.control.sounds["OpenClose"].Play();
                    if (closed)
                    {
                        Open();
                    }
                    else if (!TryDropItem())
                    {
                        Close();
                    }
                }
            }
        }
    }
Esempio n. 4
0
 void RpcToggleCupboard()
 {
     if (IsClosed)
     {
         if (lockLight != null)
         {
             if (lockLight.IsLocked())
             {
                 lockLight.Unlock();
                 return;
             }
             Open();
         }
         else
         {
             Open();
         }
     }
     else
     {
         Close();
     }
 }
Esempio n. 5
0
        void SendCurrentState(string playerRequesting)
        {
            if (PhotonNetwork.isMasterClient)
            {
                PhotonView[] objectsInCupB = items.GetPhotonViewsInChildren();
                if (objectsInCupB != null)
                {
                    foreach (PhotonView p in objectsInCupB)
                    {
                        photonView.RPC("DropItem", PhotonTargets.Others, p.viewID); //Make sure all spawneditems are where they should be on new player join
                    }
                }

                if (lockLight != null)
                {
                    photonView.RPC("ReceiveCurrentState", PhotonTargets.Others, playerRequesting, lockLight.IsLocked(), doorTrigger.IsClosed, transform.parent.transform.position); //Gather the values and send back
                }
                else
                {
                    photonView.RPC("ReceiveCurrentState", PhotonTargets.Others, playerRequesting, false, doorTrigger.IsClosed, transform.parent.transform.position); //Gather the values and send back
                }
            }
        }