Example #1
0
        public void EnterStation()
        {
            VRC_Pickup temp = (VRC_Pickup)this.gameObject.GetComponent(typeof(VRC_Pickup));

            if (Pickup_Collider != null && Networking.LocalPlayer.isLocal)
            {
                Pickup_Collider.enabled = false;
            }
            if (Networking.LocalPlayer == null || Networking.LocalPlayer.isLocal)
            {
                if (temp != null && temp.IsHeld && (Networking.LocalPlayer == null || temp.currentPlayer == Networking.LocalPlayer)) /*Eliminates grab-seat infinite physics loop*/
                {
                    temp.Drop();
                }
                if (Networking.LocalPlayer != null)
                {
                    Networking.LocalPlayer.UseAttachedStation();
                }
                Debug.Log("Player got in seat/station.");
                // SendCustomEvent("Hide");

                Collider tempCollider = (Collider)this.gameObject.GetComponent(typeof(Collider));
                if (tempCollider != null)
                {
                    tempCollider.enabled = false;
                }
            }
        }
Example #2
0
 private void Start()
 {
     // property blocks
     sphereBlock    = new MaterialPropertyBlock();
     fingerSphereOn = new MaterialPropertyBlock();
     fingerSphereOn.SetInt("_Enabled", 1);
     fingerSphereOff = new MaterialPropertyBlock();
     fingerSphereOff.SetInt("_Enabled", 0);
     // handle default values
     cam                = cameraObject.GetComponent <Camera>();
     zoom               = Remap(cam.focalLength, 5, 60, 0, 1);
     zoomSlider.value   = zoom;
     vrZoomSlider.value = zoom;
     focal              = 0.5f;
     lensAnimator.SetFloat("Focal", focal);
     focalSlider.value   = focal;
     vrFocalSlider.value = focal;
     // handle vr/desktop switch
     col        = gameObject.GetComponent <BoxCollider>();
     constraint = gameObject.GetComponent <ParentConstraint>();
     cR         = visuals.GetComponent <MeshRenderer>();
     sR         = viewSphere.GetComponent <MeshRenderer>();
     fingerSphere.gameObject.SetActive(false);
     pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
     player = Networking.LocalPlayer;
     if (player == null)
     {
         return;
     }
 }
Example #3
0
        public void Init(EraserManager eraserManager, Settings settings)
        {
            this.eraserManager = eraserManager;

            inkLayer    = settings.inkLayer;
            eraserLayer = settings.eraserLayer;
            inkPrefix   = settings.inkPrefix;
            inkPoolName = settings.inkPoolName;

            gameObject.layer = eraserLayer;

            renderer = GetComponent <Renderer>();
            if (eraserManager)
            {
                // For stand-alone erasers
                pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
                pickup.InteractionText = nameof(Eraser);
                pickup.UseText         = "Erase";
            }
            else
            {
                renderer.sharedMaterial = normal;
                inkPool = settings.inkPool;
            }
        }
Example #4
0
    /// <summary>
    /// Automatic Ball Respawn on:
    /// - > 2 Seconds no Movement but also not in hand of a player
    /// - Ball is under the table
    /// - Ball has a distance larger then necessary
    /// </summary>
    private void Update()
    {
        float      currentDistance = (BallSpawn.transform.position - gameObject.transform.position).magnitude;
        float      currentVelocity = gameObject.GetComponent <Rigidbody>().velocity.magnitude;
        VRC_Pickup pickup          = (VRC_Pickup)gameObject.GetComponent(typeof(VRC_Pickup));

        if (currentDistance > 0.2 && currentVelocity == 0 && !pickup.IsHeld)
        {
            if (Time.time - lastMove > 2)
            {
                RespawnBall();
            }
        }
        else
        {
            lastMove = Time.time;
        }

        if (
            currentDistance > maxDistance ||
            gameObject.transform.localPosition.y < -12
            )
        {
            RespawnBall();
        }
    }
Example #5
0
 void Start()
 {
     toggles                = ToggleRoot.GetComponentsInChildren <UnityEngine.UI.Toggle>(includeInactive: true);
     lastSeenToggle         = new bool[toggles.Length];
     activePlayerLastUpdate = new string[toggles.Length];
     texts    = ToggleRoot.GetComponentsInChildren <UnityEngine.UI.Text>(includeInactive: true);
     pickup   = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
     collider = GetComponent <BoxCollider>();
 }
Example #6
0
 private void Start()
 {
     pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
     if (Networking.IsOwner(gameObject))
     {
         startPosition = transform.position;
         startRotation = transform.rotation;
     }
 }
Example #7
0
 void Start()
 {
     if (!flydirection)
     {
         flydirection = transform;
     }
     localUser = Networking.LocalPlayer;
     pickup    = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
 }
    // Token: 0x06005070 RID: 20592 RVA: 0x001B8390 File Offset: 0x001B6790
    public static bool IsHeld(this GameObject go)
    {
        if (go == null)
        {
            return(false);
        }
        VRC_Pickup componentInParent = go.GetComponentInParent <VRC_Pickup>();

        return(componentInParent != null && componentInParent.IsHeld);
    }
Example #9
0
 private void Start()
 {
     if (pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup)))
     {
         pickup.InteractionText = $"{(!isActive ? "A" : "Dea")}ctivate (Local)";
         pickup.UseText         = "";
         pickup.pickupable      = true;
         GetComponent <Rigidbody>().isKinematic = true;
     }
 }
Example #10
0
        public static VRCPlayerApi GetCurrentPlayer(VRC_Pickup pickup)
        {
            CyanEmuPickupHelper helper = pickup.GetComponent <CyanEmuPickupHelper>();

            if (helper.isHeld_)
            {
                return(Networking.LocalPlayer);
            }
            return(null);
        }
Example #11
0
        public static VRC_Pickup.PickupHand GetPickupHand(VRC_Pickup pickup)
        {
            CyanEmuPickupHelper helper = pickup.GetComponent <CyanEmuPickupHelper>();

            if (helper.isHeld_)
            {
                return(VRC_Pickup.PickupHand.Right);
            }
            return(VRC_Pickup.PickupHand.None);
        }
        private void Start()
        {
            grip = (VRC_Pickup)GetComponentInChildren(typeof(VRC_Pickup));

            if (audioSource != null)
            {
                audioSource.loop   = true;
                audioSource.volume = 0;
                audioSource.pitch  = audioPitchStart;
            }
        }
    void Start()
    {
        Debug.Log(hitMask.value);
        pickup               = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
        transform            = GetComponent <Transform>();
        transform.hasChanged = false;

        for (int i = 0; i < rayvisual.Length; i++)
        {
            rayvisual[i].enabled = false;
        }
    }
        public static void InitializePickup(VRC_Pickup pickup)
        {
            if (pickup.gameObject.GetComponent <CyanEmuPickupHelper>() != null)
            {
                pickup.LogWarning("Multiple VRC_Pickup components on the same gameobject! " + VRC.Tools.GetGameObjectPath(pickup.gameObject));
                return;
            }

            CyanEmuPickupHelper helper = pickup.gameObject.AddComponent <CyanEmuPickupHelper>();

            helper.SetPickup(pickup);
        }
Example #15
0
        public static void InitializePickup(VRC_Pickup pickup)
        {
            CyanEmuPickupHelper previousHelper = pickup.gameObject.GetComponent <CyanEmuPickupHelper>();

            if (previousHelper != null)
            {
                DestroyImmediate(previousHelper);
                pickup.LogWarning("Destroying old pickup helper on object: " + VRC.Tools.GetGameObjectPath(pickup.gameObject));
            }

            CyanEmuPickupHelper helper = pickup.gameObject.AddComponent <CyanEmuPickupHelper>();

            helper.SetPickup(pickup);
        }
    void Start()
    {
        user              = Networking.LocalPlayer;
        carrigid          = GetComponent <Rigidbody>();
        transform         = GetComponent <Transform>();
        pickup            = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
        pickup.pickupable = false;
        for (int i = 0; i < wheels.Length; i++)
        {
            wheels[i].brakeTorque = float.MaxValue;
        }

        carrigid.centerOfMass = centerofmass.localPosition;
    }
Example #17
0
        public void Start()
        {
            if (Networking.LocalPlayer == null)
            {
                gameObject.SetActive(false);
                return;
            }

            cueRespawnPosition = transform.localPosition;
            playerApi          = Networking.LocalPlayer;
            usingDesktop       = !playerApi.IsUserInVR();

            ownCollider = GetComponent <Collider>();

            targetTransform          = otherHand.transform;
            otherHandRespawnPosition = targetTransform.localPosition;

            targetCollider = targetTransform.GetComponent <Collider>();
            if (!targetCollider)
            {
                Debug.LogError("PoolCue: Start: target is missing a collider. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            ResetTarget();

            thisPickup = (VRC_Pickup)gameObject.GetComponent(typeof(VRC_Pickup));
            if (!thisPickup)
            {
                Debug.LogError("PoolCue: Start: this object is missing a VRC_Pickup script. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            targetPickup = (VRC_Pickup)targetTransform.GetComponent(typeof(VRC_Pickup));
            if (!targetPickup)
            {
                Debug.LogError("PoolCue: Start: target object is missing a VRC_Pickup script. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            startingRotation = cueParent.localRotation;

            _DenyAccess();

            startupCompleted = true;
        }
Example #18
0
        private static float MaxValue(object pickup)
        {
            VRC_Pickup vrc_Pickup = pickup as VRC_Pickup;

            if (vrc_Pickup != null)
            {
                return(vrc_Pickup.proximity);
            }
            VRC_Interactable vrc_Interactable = pickup as VRC_Interactable;

            if (vrc_Interactable == null)
            {
                return(0f);
            }
            return(vrc_Interactable.proximity);
        }
Example #19
0
 // Token: 0x0600554B RID: 21835 RVA: 0x001D6974 File Offset: 0x001D4D74
 public void PickupSelected(VRC_Pickup pickup, bool leftHand)
 {
     if (pickup.currentlyHeldBy != null)
     {
         return;
     }
     if (VRCInputManager.IsUsingHandController())
     {
         ControllerInputUI controllerPart = (VRCInputManager.LastInputMethod != VRCInputManager.InputMethod.Oculus) ? ControllerInputUI.Trigger : ControllerInputUI.Grip;
         this.ActivateControllerLabel((!leftHand) ? ControllerHand.Right : ControllerHand.Left, controllerPart, (!VRCHandGrasper.IsAutoEquipPickup(pickup)) ? "Hold to Grab" : "Equip", 0.1f, 0);
     }
     else if (!this.IsShowingOtherLabelOfType(TutorialLabelType.Pickup, pickup.transform))
     {
         this.ActivateObjectLabel(pickup.transform, TutorialLabelType.Pickup, (!leftHand) ? ControllerHand.Right : ControllerHand.Left, (!VRCInputManager.IsUsingAutoEquipControllerType() || !VRCHandGrasper.IsAutoEquipPickup(pickup)) ? "Hold to Grab" : "Equip", ControllerActionUI.Use, 0.1f, 0, AttachMode.PositionOnly, false);
     }
 }
Example #20
0
        public void Init(PenManager manager)
        {
            penManager = manager;

            inkPool.name         = inkPoolName;
            colliderHolder.layer = inkLayer;

            inkPrefab.SetActive(false);
            eraser.gameObject.SetActive(false);

            pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
            pickup.InteractionText = nameof(Pen);
            pickup.UseText         = "Draw";

            // PenManager : Manager, EraserManager : Manager, Init(Manager manager)
            eraser.Init(null);
        }
Example #21
0
    private void Start()
    {
        // Match lerped positions at start
        lag_objBase   = this.transform.position;
        lag_objTarget = objTarget.transform.position;

        targetOriginalDelta = this.transform.InverseTransformPoint(objTarget.transform.position);
        OnDrop();

        pickup_this   = (VRC_Pickup)this.gameObject.GetComponent(typeof(VRC_Pickup));
        pickup_target = (VRC_Pickup)objTarget.GetComponent(typeof(VRC_Pickup));

        reset_pos_target = objTarget.transform.position;
        reset_pos_this   = this.transform.position;

        localplayer = Networking.LocalPlayer;
    }
Example #22
0
        private void Start()
        {
            // property blocks
            sphereBlock    = new MaterialPropertyBlock();
            fingerSphereOn = new MaterialPropertyBlock();
            fingerSphereOn.SetInt("_Enabled", 1);
            fingerSphereOff = new MaterialPropertyBlock();
            fingerSphereOff.SetInt("_Enabled", 0);
            // handle default values
            cam                = cameraObject.GetComponent <Camera>();
            zoom               = Remap(cam.focalLength, 5, 60, 0, 1);
            zoomSlider.value   = zoom;
            vrZoomSlider.value = zoom;
            focal              = 0.5f;
            lensAnimator.SetFloat("Focal", focal);
            focalSlider.value   = focal;
            vrFocalSlider.value = focal;
            // handle vr/desktop switch
            col        = gameObject.GetComponent <BoxCollider>();
            constraint = gameObject.GetComponent <ParentConstraint>();
            cR         = visuals.GetComponent <MeshRenderer>();
            sR         = viewSphere.GetComponent <MeshRenderer>();
            fingerSphere.gameObject.SetActive(false);
            pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
            var player = Networking.LocalPlayer;

            if (player == null)
            {
                return;
            }
            if (player.IsUserInVR())
            {
                cameraAnimator.SetBool("IsVR", true);
                vrUI.SetActive(true);
                isDesktop = false;
                constraint.constraintActive = false;
                pickup.pickupable           = true;
                return;
            }

            desktopUI.SetActive(true);
            sphereBlock.SetInt("_Watermark", 1);
            sphereBlock.SetFloat("_SceneStartTime", Time.time - 1);
            sR.SetPropertyBlock(sphereBlock);
        }
    // Token: 0x06005424 RID: 21540 RVA: 0x001D0E1C File Offset: 0x001CF21C
    private IEnumerator Die()
    {
        if (!base.photonView.isMine)
        {
            yield break;
        }
        VRC_PlayerApi localPlayerApi = base.GetComponent <VRC_PlayerApi>();

        Debug.Log("Local Death");
        InputStateControllerManager inputControllerManager = VRCPlayer.Instance.GetComponent <InputStateControllerManager>();

        inputControllerManager.PushInputController("ImmobileInputController");
        VRC.Network.RPC(VRC_EventHandler.VrcTargetType.All, base.gameObject, "ShowDeath", new object[0]);
        VRC_Pickup leftPickup = localPlayerApi.GetPickupInHand(VRC_Pickup.PickupHand.Left);

        if (leftPickup != null)
        {
            leftPickup.Drop();
        }
        VRC_Pickup rightPickup = localPlayerApi.GetPickupInHand(VRC_Pickup.PickupHand.Right);

        if (rightPickup != null)
        {
            rightPickup.Drop();
        }
        localPlayerApi.EnablePickups(false);
        if (this.theCombatSystem.onPlayerKilled != null)
        {
            this.theCombatSystem.onPlayerKilled(base.GetComponent <VRC_PlayerApi>());
        }
        if (this.theCombatSystem.respawnOnDeath)
        {
            yield return(new WaitForSeconds(this.theCombatSystem.respawnTime));

            this.Respawn();
        }
        else
        {
            yield return(null);
        }
        this.DeathCoroutine = null;
        yield break;
    }
Example #24
0
    private void Start()
    {
        // Match lerped positions at start
        lag_objBase   = this.transform.position;
        lag_objTarget = objTarget.transform.position;

      #if !HT_QUEST
        dkShotDist = k_dkShotReset;
      #endif

        targetOriginalDelta = this.transform.InverseTransformPoint(objTarget.transform.position);
        OnDrop();

        pickup_this   = (VRC_Pickup)this.gameObject.GetComponent(typeof(VRC_Pickup));
        pickup_target = (VRC_Pickup)objTarget.GetComponent(typeof(VRC_Pickup));

        reset_pos_target = objTarget.transform.position;
        reset_pos_this   = this.transform.position;
    }
Example #25
0
        public void Init(EraserManager manager)
        {
            eraserManager = manager;

            gameObject.layer = eraserLayer;

            renderer         = GetComponent <Renderer>();
            renderer.enabled = true;
            if (!eraserManager)
            {
                // For stand-alone erasers
                renderer.sharedMaterial = normal;
            }

            pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup));
            if (pickup)
            {
                pickup.InteractionText = nameof(Eraser);
                pickup.UseText         = "Erase";
            }
        }
Example #26
0
    // Token: 0x060051E5 RID: 20965 RVA: 0x001C0B14 File Offset: 0x001BEF14
    public static VRC_Pickup GetPickupInHand(VRC_PlayerApi player, VRC_Pickup.PickupHand hand)
    {
        VRC_Pickup result = null;

        VRCHandGrasper[] graspers = InternalSDKPlayer.GetGraspers(player);
        if (graspers.Length == 2)
        {
            if (hand != VRC_Pickup.PickupHand.Right)
            {
                if (hand == VRC_Pickup.PickupHand.Left)
                {
                    result = graspers[0].GetGraspedPickup();
                }
            }
            else
            {
                result = graspers[1].GetGraspedPickup();
            }
        }
        return(result);
    }
Example #27
0
        public void Start()
        {
            ownCollider = GetComponent <SphereCollider>();

            targetCollider = target.GetComponent <SphereCollider>();
            if (!targetCollider)
            {
                Debug.LogError("ht8b_cue: Start: target is missing a SphereCollider. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            // Match lerped positions at start
            cueMainGripOriginalPosition    = gameObject.transform.position;
            cueOffhandGripOriginalPosition = target.transform.position;

            OnDrop();

            thisPickup = (VRC_Pickup)gameObject.GetComponent(typeof(VRC_Pickup));
            if (!thisPickup)
            {
                Debug.LogError("ht8b_cue: Start: this object is missing a VRC_Pickup script. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            targetPickup = (VRC_Pickup)target.GetComponent(typeof(VRC_Pickup));
            if (!targetPickup)
            {
                Debug.LogError("ht8b_cue: Start: target object is missing a VRC_Pickup script. Aborting cue setup.");
                gameObject.SetActive(false);
                return;
            }

            targetResetPosition = target.transform.position;
            cueResetPosition    = gameObject.transform.position;

            DenyAccess();
        }
Example #28
0
 private void SetPickup(VRC_Pickup pickup)
 {
     pickup_    = pickup;
     rigidbody_ = GetComponent <Rigidbody>();
 }
Example #29
0
        public static void ForceDrop(VRC_Pickup pickup)
        {
            CyanEmuPickupHelper helper = pickup.GetComponent <CyanEmuPickupHelper>();

            helper.Drop();
        }
Example #30
0
        private void Start()
        {
            defaultPosition = transform.position;
            defaultRotation = transform.rotation;

            if (pickup = (VRC_Pickup)GetComponent(typeof(VRC_Pickup)))
            {
                pickup.InteractionText = nameof(Udon.QvPen);
                pickup.UseText         = "Draw";
            }
            else
            {
                Debug.LogError("VRC_Pickup component is not found.", this);
            }

            if (inkPrefab)
            {
                inkPrefab.SetActive(false);
            }
            else
            {
                Debug.LogError("Ink Object is none.", this);
            }

            if (!inkPrefab.transform.GetComponent <TrailRenderer>())
            {
                Debug.LogError("Trail Renderer is not attached to Ink Prefab.", this);
            }

            if (!spawnTarget)
            {
                Debug.LogError("Spawn Target is none.", this);
            }

            if (positionConstraint = spawnTarget.GetComponent <PositionConstraint>())
            {
                positionConstraint.enabled = true;
            }
            else
            {
                Debug.LogError("Position Constraint component is not found.", this);
            }

            if (smoothFollowToggle = spawnTarget.GetComponent <Toggle>())
            {
                smoothFollowToggle.isOn = false;
            }
            else
            {
                Debug.LogError("Smooth Follow Enabler is not found.", this);
            }

            if (!inkPool)
            {
                Debug.LogError("Ink Prefab is none.", this);
            }

            if (!penManager)
            {
                Debug.LogError("Pen Manager is none.", this);
            }
        }