Ejemplo n.º 1
0
        public override void BeginInteraction(NVRHand hand)
        {
            if (GetComponent <PlayerBrain>().enabled)
            {
                GetComponent <PlayerBrain>().enabled = false;
            }

            base.BeginInteraction(hand);

            StartingDrag          = Rigidbody.drag;
            StartingAngularDrag   = Rigidbody.angularDrag;
            Rigidbody.drag        = 0;
            Rigidbody.angularDrag = 0.05f;

            PickupTransform          = new GameObject(string.Format("[{0}] NVRPickupTransform", this.gameObject.name)).transform;
            PickupTransform.parent   = hand.transform;
            PickupTransform.position = this.transform.position;
            PickupTransform.rotation = this.transform.rotation;

            ResetVelocityHistory();

            if (OnBeginInteraction != null)
            {
                OnBeginInteraction.Invoke();
            }
        }
Ejemplo n.º 2
0
        protected override void Start()
        {
            base.Start();

            if (!(GetComponent <NVRSnappable> ()))
            {
                snappable = gameObject.AddComponent <NVRSnappable> ();
                OnBeginInteraction.AddListener(snappable.StartSnapping);
                OnEndInteraction.AddListener(snappable.StopSnapping);
            }
        }
Ejemplo n.º 3
0
    public override void BeginInteraction(NVRHand hand)
    {
        base.BeginInteraction(hand);

        // Our addition
        Animation      fishAnimation = this.GetComponentInChildren <Animation>();
        Rigidbody      fishRigid     = this.GetComponent <Rigidbody>();
        CharacterJoint fishJoint     = this.GetComponent <CharacterJoint>();

        Destroy(fishJoint);
        fishRigid.mass       = 5;
        fishRigid.useGravity = true;

        fishAnimation.Stop();
        fishLogic.caught   = false;
        fishLogic.fishDead = true;
        // End of our addition

        StartingDrag          = Rigidbody.drag;
        StartingAngularDrag   = Rigidbody.angularDrag;
        Rigidbody.drag        = 0;
        Rigidbody.angularDrag = 0.05f;

        if (DisablePhysicalMaterialsOnAttach == true)
        {
            DisablePhysicalMaterials();
        }

        PickupTransform          = new GameObject(string.Format("[{0}] NVRPickupTransform", this.gameObject.name)).transform;
        PickupTransform.parent   = hand.transform;
        PickupTransform.position = this.transform.position;
        PickupTransform.rotation = this.transform.rotation;

        ResetVelocityHistory();

        if (OnBeginInteraction != null)
        {
            OnBeginInteraction.Invoke();
        }
    }