Beispiel #1
0
        static void Postfix(bool __result, string ___m_rightItem, ref GameObject ___m_rightItemInstance)
        {
            if (!__result || ___m_rightItemInstance == null)
            {
                return;
            }

            MeshFilter meshFilter = ___m_rightItemInstance.GetComponentInChildren <MeshFilter>();

            if (meshFilter == null)
            {
                return;
            }

            Player player = ___m_rightItemInstance.GetComponentInParent <Player>();

            if (player == null)
            {
                return;
            }

            var vrPlayerSync = player.GetComponent <VRPlayerSync>();

            if (vrPlayerSync != null)
            {
                player.GetComponent <VRPlayerSync>().currentRightWeapon      = meshFilter.gameObject;
                player.GetComponent <VRPlayerSync>().currentRightWeapon.name = ___m_rightItem;
                VrikCreator.resetVrikHandTransform(player);
            }

            if (Player.m_localPlayer != player || !VHVRConfig.UseVrControls())
            {
                return;
            }

            if (StaticObjects.quickSwitch != null)
            {
                StaticObjects.quickSwitch.GetComponent <QuickSwitch>().refreshItems();
                StaticObjects.quickActions.GetComponent <QuickActions>().refreshItems();
            }

            switch (EquipScript.getRight())
            {
            case EquipType.Fishing:
                meshFilter.gameObject.AddComponent <FishingManager>();
                return;

            case EquipType.Spear:
            case EquipType.SpearChitin:
                meshFilter.gameObject.AddComponent <SpearManager>();
                // (no return, we want collider for spear also)
                break;
            }

            StaticObjects.rightWeaponCollider().GetComponent <WeaponCollision>().setColliderParent(meshFilter.transform, ___m_rightItem, true);
            ParticleFix.maybeFix(___m_rightItemInstance);
        }
Beispiel #2
0
        static void Postfix(bool __result, string ___m_leftItem, GameObject ___m_leftItemInstance)
        {
            if (!__result || ___m_leftItemInstance == null)
            {
                return;
            }

            MeshFilter meshFilter = ___m_leftItemInstance.GetComponentInChildren <MeshFilter>();

            if (meshFilter == null)
            {
                return;
            }

            Player player = ___m_leftItemInstance.GetComponentInParent <Player>();

            if (player == null)
            {
                return;
            }

            var vrPlayerSync = player.GetComponent <VRPlayerSync>();

            if (vrPlayerSync != null)
            {
                player.GetComponent <VRPlayerSync>().currentLeftWeapon = meshFilter.gameObject;
                VrikCreator.resetVrikHandTransform(player);
            }

            if (Player.m_localPlayer != player || !VHVRConfig.UseVrControls())
            {
                return;
            }

            if (StaticObjects.quickSwitch != null)
            {
                StaticObjects.quickSwitch.GetComponent <QuickSwitch>().refreshItems();
                StaticObjects.quickActions.GetComponent <QuickActions>().refreshItems();
            }

            switch (EquipScript.getLeft())
            {
            case EquipType.Bow:
                meshFilter.gameObject.AddComponent <BowLocalManager>();
                return;

            case EquipType.Shield:
                meshFilter.gameObject.AddComponent <ShieldManager>()._name = ___m_leftItem;
                return;
            }

            StaticObjects.leftWeaponCollider().GetComponent <WeaponCollision>().setColliderParent(meshFilter.transform, ___m_leftItem, false);
            ParticleFix.maybeFix(___m_leftItemInstance);
        }