Esempio n. 1
0
        static GameObject InitController(GameObject go, int index)
        {
            Controller ctrl = go.GetComponent <Controller>();

            if (ctrl == null)
            {
                ctrl = go.AddComponent <Controller>();
            }

            ctrl.Initialize(index);

            if (controllers == null)
            {
                controllers = new Controller[2];
            }
            controllers[index] = ctrl;

            if (newPosesAppliedAction == null)
            {
                newPosesAppliedAction         = SteamVR_Events.NewPosesAppliedAction(OnNewPosesApplied);
                newPosesAppliedAction.enabled = true;
            }

            return(go);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes references to Reference Manager and Laser Sight, sets this
        /// GameObject to the player ship reference in Reference Manager.
        /// </summary>
        private void Awake()
        {
            reference             = FindObjectOfType <ReferenceManager>();
            newPosesAppliedAction = SteamVR_Events.NewPosesAppliedAction(OnNewPosesApplied);

            if (reference == null)
            {
                Debug.LogError(GetType().Name + " - Could not find Reference Manager!");
            }
            else
            {
                reference.playerShip       = gameObject;
                reference.playerShipSource = source;

                reference.tooltips.ShipGrabbed();

                SetWeapon((int)reference.gameSettings.selectedWeapon);

                if (reference.shipPickup)
                {
                    reference.shipPickup.SetActive(false);
                }

                if (reference.powerUpStatus)
                {
                    reference.powerUpStatus.BeginTracking(reference, hand);
                }

                if (reference.gameSettings.selectedGameMode == GameSettings.GameMode.SoloNormal)
                {
                    if (reference.waveManager != null)
                    {
                        reference.waveManager.Run();
                    }
                    else
                    {
                        Debug.LogError(GetType().Name +
                                       " - Reference.WaveManager is null. Cannot call Run().");
                    }
                }
                else
                {
                    if (reference.countdown)
                    {
                        reference.countdown.SetActive(true);
                    }
                    else
                    {
                        Debug.LogError(
                            GetType().Name + " - Reference.Countdown is null. Cannot enable.");
                    }
                }

                StartCoroutine(IntroAudio());
                reference.tooltips.SpawnProtectShip();
            }
        }
Esempio n. 3
0
        //-------------------------------------------------
        //被VRTK抓取事件处理函数替代
        //private void OnAttachedToHand(Hand attachedHand)
        //{
        //    hand = attachedHand;
        //}

        //-------------------------------------------------
        void Awake()
        {
            longBowAni            = GetComponent <Animator>();
            longBowAni.speed      = 0;
            bowCollider           = GetComponent <SphereCollider>();
            newPosesAppliedAction = SteamVR_Events.NewPosesAppliedAction(OnNewPosesApplied);
            GetComponent <VRTK_InteractableObject>().InteractableObjectGrabbed   += VRTKLongBow_InteractableObjectGrabbed;
            GetComponent <VRTK_InteractableObject>().InteractableObjectUngrabbed += VRTKLongBow_InteractableObjectUngrabbed;
        }
        protected virtual void Awake()
        {
            if (MixCastCameras.Instance != null)
            {
                MixCastCameras.Instance.OnBeforeRender += LateUpdate;
            }

#if MIXCAST_STEAMVR
            newPosesAppliedAction = SteamVR_Events.NewPosesAppliedAction(OnNewPosesApplied);

            isTrackedDeviceReady = true;
#endif
        }
Esempio n. 5
0
 //-------------------------------------------------
 private void Awake()
 {
     newPosesAppliedAction = SteamVR_Events.NewPosesAppliedAction(OnNewPosesApplied);
 }
Esempio n. 6
0
 // Token: 0x06005DCE RID: 24014 RVA: 0x0020D23E File Offset: 0x0020B63E
 private void Awake()
 {
     this.newPosesAppliedAction = SteamVR_Events.NewPosesAppliedAction(new UnityAction(this.OnNewPosesApplied));
 }