예제 #1
0
    private void NetworkedUnGrab(int id, string itemName)
    {
        if (PhotonView.Find(id) == null)
        {
            return;
        }
        PhotonObjectInteract component = PhotonView.Find(id).GetComponent <PhotonObjectInteract>();

        if (component.transformView)
        {
            component.transformView.m_RotationModel.SynchronizeEnabled = true;
            component.transformView.m_PositionModel.SynchronizeEnabled = true;
        }
        component.isGrabbed = false;
        if (PhotonNetwork.inRoom && !this.view.isMine)
        {
            this.inventoryProps[this.inventoryIndex] = null;
        }
        if (this.view.isMine || !PhotonNetwork.inRoom)
        {
            component.GetComponent <Rigidbody>().isKinematic = component.wasKinematic;
        }
        component.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.Continuous;
        component.transform.SetParent(null);
    }
예제 #2
0
    private void NetworkedGrab(int id)
    {
        if (PhotonView.Find(id) == null)
        {
            return;
        }
        PhotonObjectInteract component = PhotonView.Find(id).GetComponent <PhotonObjectInteract>();

        if (component.transformView)
        {
            component.transformView.m_RotationModel.SynchronizeEnabled = false;
            component.transformView.m_PositionModel.SynchronizeEnabled = false;
        }
        if (!this.view.isMine)
        {
            this.inventoryProps[this.inventoryIndex] = component;
        }
        component.isGrabbed = true;
        component.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
        component.GetComponent <Rigidbody>().isKinematic            = true;
        component.transform.SetParent(this.grabSpotJoint.transform);
        if (component.GetComponent <Tripod>())
        {
            component.transform.localPosition = new Vector3(0f, -0.9f, 0f);
        }
        else
        {
            component.transform.localPosition = Vector3.zero;
        }
        Quaternion localRotation = component.transform.localRotation;

        localRotation.eulerAngles         = component.localPlayerRotation;
        component.transform.localRotation = localRotation;
    }
예제 #3
0
 // Token: 0x060006CA RID: 1738 RVA: 0x00025DC5 File Offset: 0x00023FC5
 public DoorState(GhostAI ghostAI, GhostInteraction ghostInteraction, GhostInfo ghostInfo, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.ghostInfo        = ghostInfo;
     this.door             = obj.GetComponent <Door>();
 }
예제 #4
0
        private void SyncDropZone(int viewID)
        {
            if (PhotonView.Find(viewID) == null)
            {
                return;
            }
            PhotonObjectInteract component = PhotonView.Find(viewID).GetComponent <PhotonObjectInteract>();

            if (component == null)
            {
                return;
            }
            if (this.isBeltDropZone && !this.view.isMine)
            {
                component.isGrabbed = true;
            }
            switch (this.snapType)
            {
            case VRTK_SnapDropZone.SnapTypes.UseKinematic:
                component.SaveCurrentState();
                component.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                component.isKinematic = true;
                break;

            case VRTK_SnapDropZone.SnapTypes.UseJoint:
                this.SetSnapDropZoneJoint(component.GetComponent <Rigidbody>());
                break;

            case VRTK_SnapDropZone.SnapTypes.UseParenting:
                component.SaveCurrentState();
                component.GetComponent <Rigidbody>().collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                component.isKinematic = true;
                component.transform.SetParent(base.transform);
                if (this.isBeltDropZone)
                {
                    Quaternion localRotation = component.transform.localRotation;
                    localRotation.eulerAngles         = component.localPlayerRotation;
                    component.transform.localRotation = localRotation;
                }
                break;
            }
            this.OnObjectSnappedToDropZone(this.SetSnapDropZoneEvent(component.gameObject));
        }
예제 #5
0
        // Token: 0x06001202 RID: 4610 RVA: 0x00067C08 File Offset: 0x00065E08
        protected virtual PhotonObjectInteract ValidSnapObject(GameObject checkObject, bool grabState, bool checkGrabState = true)
        {
            PhotonObjectInteract component = checkObject.GetComponent <PhotonObjectInteract>();

            if (component == null)
            {
                return(null);
            }
            if (VRTK_PolicyList.Check(component.gameObject, this.validObjectListPolicy))
            {
                return(null);
            }
            if (component.view == null)
            {
                return(null);
            }
            if (component.isFixedItem || !component.isProp)
            {
                return(null);
            }
            if (!this.isHeadCamDropZone && component.GetComponent <CCTV>() && component.GetComponent <CCTV>().isHeadCamera)
            {
                return(null);
            }
            if (component.GetComponent <Tripod>())
            {
                return(null);
            }
            if (component.isGrabbed != grabState)
            {
                return(null);
            }
            if (!component.view.isMine)
            {
                return(null);
            }
            return(component);
        }
예제 #6
0
    // Token: 0x0600067E RID: 1662 RVA: 0x00024484 File Offset: 0x00022684
    public void InteractWithARandomDoor()
    {
        if (this.ghostAI.ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Shade && LevelController.instance.currentGhostRoom.playersInRoom.Count > 1)
        {
            this.ghostAI.ChangeState(GhostAI.States.favouriteRoom, null, null);
            return;
        }
        PhotonObjectInteract doorToOpen = this.GetDoorToOpen();

        if (doorToOpen == null)
        {
            this.InteractWithARandomProp();
            return;
        }
        if (doorToOpen.GetComponent <Door>())
        {
            if (doorToOpen.GetComponent <Door>().type == Key.KeyType.main)
            {
                if (Random.Range(0, 5) < 3)
                {
                    this.ghostAI.ChangeState(GhostAI.States.door, doorToOpen, null);
                    return;
                }
                this.ghostAI.ChangeState(GhostAI.States.doorKnock, null, null);
                return;
            }
            else
            {
                if (Random.Range(0, 3) < 2)
                {
                    this.ghostAI.ChangeState(GhostAI.States.door, doorToOpen, null);
                    return;
                }
                this.ghostAI.ChangeState(GhostAI.States.lockDoor, doorToOpen, null);
            }
        }
    }
예제 #7
0
    // Token: 0x0600067D RID: 1661 RVA: 0x0002441C File Offset: 0x0002261C
    public void GhostWriting()
    {
        PhotonObjectInteract photonObjectInteract = null;

        for (int i = 0; i < this.objectsToInteractWith.Count; i++)
        {
            if (this.objectsToInteractWith[i].GetComponent <GhostWriting>())
            {
                photonObjectInteract = this.objectsToInteractWith[i];
            }
        }
        if (photonObjectInteract == null)
        {
            this.InteractWithARandomProp();
            return;
        }
        photonObjectInteract.GetComponent <GhostWriting>().Use();
    }
예제 #8
0
 // Token: 0x06000BCC RID: 3020 RVA: 0x0004922C File Offset: 0x0004742C
 private void Grab(PhotonObjectInteract grabbedItem)
 {
     if (this.player.isDead)
     {
         return;
     }
     if (PhotonNetwork.inRoom)
     {
         grabbedItem.view.RequestOwnership();
     }
     grabbedItem.OnPCGrabbed.Invoke();
     if (grabbedItem != null)
     {
         if (this.inventoryProps[this.inventoryIndex] == grabbedItem)
         {
             if (grabbedItem.myRightHandModel != null)
             {
                 grabbedItem.myRightHandModel.SetActive(true);
             }
         }
         else if (PhotonNetwork.inRoom)
         {
             this.view.RPC("EnableOrDisableObject", PhotonTargets.AllBuffered, new object[]
             {
                 grabbedItem.view.viewID,
                 false
             });
         }
         else
         {
             this.EnableOrDisableObject(grabbedItem.view.viewID, false);
         }
         Collider[] components = grabbedItem.GetComponents <Collider>();
         for (int i = 0; i < components.Length; i++)
         {
             components[i].enabled = false;
         }
         this.player.charAnim.SetTrigger("SwitchHolding");
         this.player.charAnim.SetBool("isHolding", true);
         if (PhotonNetwork.inRoom)
         {
             this.view.RPC("NetworkedGrab", PhotonTargets.AllBuffered, new object[]
             {
                 grabbedItem.view.viewID
             });
         }
         Rigidbody component = grabbedItem.GetComponent <Rigidbody>();
         this.grabSpotJoint.connectedBody = component;
         component.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
         component.isKinematic            = true;
         grabbedItem.transform.SetParent(this.cameraItemSpot);
         if (grabbedItem.GetComponent <Tripod>())
         {
             grabbedItem.transform.localPosition = new Vector3(0f, -0.6f, 0f);
         }
         else
         {
             grabbedItem.transform.localPosition = grabbedItem.localPlayerPosition;
         }
         Quaternion localRotation = grabbedItem.transform.localRotation;
         localRotation.eulerAngles           = grabbedItem.localPlayerRotation;
         grabbedItem.transform.localRotation = localRotation;
     }
 }
예제 #9
0
 // Token: 0x06000715 RID: 1813 RVA: 0x00029AF0 File Offset: 0x00027CF0
 public TeleportObjectState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.teleportObj      = obj.GetComponent <TeleportableObject>();
 }
예제 #10
0
 // Token: 0x06000711 RID: 1809 RVA: 0x00029A98 File Offset: 0x00027C98
 public SoundState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.sound            = obj.GetComponent <Sound>();
 }
예제 #11
0
 // Token: 0x060006FD RID: 1789 RVA: 0x000297D9 File Offset: 0x000279D9
 public LightState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.lightSwitch      = obj.GetComponent <LightSwitch>();
 }
예제 #12
0
 // Token: 0x060006BA RID: 1722 RVA: 0x00025A2F File Offset: 0x00023C2F
 public CCTVState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.cam = obj.GetComponent <CCTV>();
 }
예제 #13
0
 // Token: 0x060006B2 RID: 1714 RVA: 0x00025650 File Offset: 0x00023850
 public AnimationObjectState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.animation        = obj.GetComponent <AnimationObject>();
 }
예제 #14
0
    // Token: 0x0600067C RID: 1660 RVA: 0x00024204 File Offset: 0x00022404
    public void InteractWithARandomProp()
    {
        if (this.objectsToInteractWith.Count == 0)
        {
            this.ghostAI.ChangeState(GhostAI.States.favouriteRoom, null, null);
            return;
        }
        if (this.ghostAI.ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Shade && LevelController.instance.currentGhostRoom.playersInRoom.Count > 1)
        {
            this.ghostAI.ChangeState(GhostAI.States.favouriteRoom, null, null);
            return;
        }
        PhotonObjectInteract photonObjectInteract = this.objectsToInteractWith[Random.Range(0, this.objectsToInteractWith.Count)];

        if (photonObjectInteract.GetComponent <LightSwitch>())
        {
            if (Random.Range(0, 4) < 3)
            {
                this.ghostAI.ChangeState(GhostAI.States.light, photonObjectInteract, null);
                return;
            }
            this.ghostAI.ChangeState(GhostAI.States.flicker, photonObjectInteract, null);
            return;
        }
        else
        {
            if (photonObjectInteract.GetComponent <Car>())
            {
                this.ghostAI.ChangeState(GhostAI.States.carAlarm, null, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Window>())
            {
                this.ghostAI.ChangeState(GhostAI.States.windowKnock, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Radio>())
            {
                this.ghostAI.ChangeState(GhostAI.States.radio, null, null);
                return;
            }
            if (photonObjectInteract.GetComponent <CCTV>())
            {
                this.ghostAI.ChangeState(GhostAI.States.cctv, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Sink>())
            {
                this.ghostAI.ChangeState(GhostAI.States.sink, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Sound>())
            {
                this.ghostAI.ChangeState(GhostAI.States.sound, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Painting>())
            {
                this.ghostAI.ChangeState(GhostAI.States.painting, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <Mannequin>())
            {
                this.ghostAI.ChangeState(GhostAI.States.mannequin, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <TeleportableObject>())
            {
                this.ghostAI.ChangeState(GhostAI.States.teleportObject, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <AnimationObject>())
            {
                this.ghostAI.ChangeState(GhostAI.States.animationObject, photonObjectInteract, null);
                return;
            }
            if (photonObjectInteract.GetComponent <GhostWriting>())
            {
                photonObjectInteract.GetComponent <GhostWriting>().Use();
                this.ghostAI.ChangeState(GhostAI.States.throwing, photonObjectInteract, null);
                return;
            }
            this.ghostAI.ChangeState(GhostAI.States.throwing, this.GetPropToThrow(), null);
            return;
        }
    }
예제 #15
0
 // Token: 0x0600070D RID: 1805 RVA: 0x00029A28 File Offset: 0x00027C28
 public SinkState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.sink             = obj.GetComponent <Sink>();
 }
예제 #16
0
 // Token: 0x06000705 RID: 1797 RVA: 0x000298F4 File Offset: 0x00027AF4
 public PaintingState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.painting         = obj.GetComponent <Painting>();
 }
예제 #17
0
 // Token: 0x06000722 RID: 1826 RVA: 0x00029F0B File Offset: 0x0002810B
 public WindowKnockState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.window           = obj.GetComponent <Window>();
 }
예제 #18
0
 // Token: 0x06000701 RID: 1793 RVA: 0x00029878 File Offset: 0x00027A78
 public MannequinState(GhostAI ghostAI, GhostInteraction ghostInteraction, PhotonObjectInteract obj)
 {
     this.ghostAI          = ghostAI;
     this.ghostInteraction = ghostInteraction;
     this.mannequin        = obj.GetComponent <Mannequin>();
 }