Example #1
0
 public bool swap(int rotAmt)
 {
     if (g == null)
     {
         return(false);
     }
     if (inventory.Count > 0)
     {
         int oldI = CurrentItemIndex;
         CurrentItemIndex = (CurrentItemIndex + inventory.ToArray().Length + rotAmt) % inventory.ToArray().Length;
         _Object current = null;
         try { current = hand.GetComponentInChildren <_Object>(); } catch { }
         if (current != null)
         {
             current.PV.RPC("snap", RpcTarget.All, -1, false);
         }
         _Object picked = null;
         try { picked = ((_Object)inventory[CurrentItemIndex]); } catch { }
         if (picked != null)
         {
             picked.PV.RPC("snap", RpcTarget.All, head.gameObject.GetComponent <PhotonView>().ViewID, true);
         }
         try { item = ((FireableObject)inventory[CurrentItemIndex]); } catch { }
         return(true);
     }
     else
     {
         CurrentItemIndex = -1;
         item             = null;
         return(false);
     }
 }
Example #2
0
 public override void grab(_Object o)
 {
     if (inventory.Count < MaxInventory && o && PV.IsMine)
     {
         o.PV.TransferOwnership(pv.Owner.ActorNumber);
         o.PV.RPC("snap", RpcTarget.All, head.gameObject.GetComponent <PhotonView>().ViewID, true);
         inventory.Add(o);
         swap(1);
     }
 }
Example #3
0
        public override void drop()
        {
            if (inventory.ToArray().Length < 1)
            {
                return;
            }
            _Object item = ((_Object)inventory[CurrentItemIndex]);

            item.drop();
            item.PV.RPC("snap", RpcTarget.All, -1, true);
            inventory.RemoveAt(CurrentItemIndex);
            item.gameObject.GetComponent <_Object>().PV.TransferOwnership(PhotonNetwork.CurrentRoom.masterClientId);
            if (PhotonNetwork.CurrentRoom.masterClientId != PhotonNetwork.LocalPlayer.ActorNumber)
            {
                item.makePhysical(false, true, true);
            }
            item.transform.localScale = new Vector3(1, 1, 1);
            this.swap(-1);
        }
Example #4
0
 public virtual void grab(_Object o)
 {
 }