Example #1
0
        private void DiveOut()
        {
            // Fade the screen back in
            SteamVR_Fade.Start(Color.clear, currentFadeTime);

            // Scale up the agent using the scaling factor
            playerRoot.transform.localScale *= currentDT.scaleFactor;

            // Update the position of the agent
            //Vector3 feetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
            player.trackingOriginTransform.position = diveOutPos; //+ feetOffset;
            player.trackingOriginTransform.rotation = diveOutRot;

            // Free the agent's hands
            leftHand.Deactivate_sword();
            rightHand.Deactivate_sword();
            leftHand.DetachObject(leftHand.currentAttachedObject);
            rightHand.DetachObject(rightHand.currentAttachedObject);

            currentDT.DeactivateBow();

            // Finish the dive process
            currentDT = null;
            diving    = false;
            //Make Playroom Sound play
            SoundManagerScript.S.MakePlayroomSound();
            SoundManagerScript.S.StopBattleSound();
        }
Example #2
0
        /** STEAMVR SYSTEM ROUTINES **/


        /** UNIQUE ROUTINES **/
        public bool TryDiveIn(DiveTarget dt, Hand divingHand)
        {
            // Prevent aimless and redundant dives
            if (dt == null || currentDT != null || diving)
            {
                return(false);
            }

            diving = true;
            nextDT = dt;
            InitiateDiveInFade(divingHand);
            return(true);
        }
Example #3
0
 public DiveTarget GetDiveTarget()
 {
     if (attachedTower != null)
     {
         DiveTarget dtRet = attachedTower.GetDiveTarget();
         if (dtOverride != null && dtRet.swordTarget)
         {
             dtRet.divePos = dtOverride;
         }
         return(dtRet);
     }
     else
     {
         return(null);
     }
 }
Example #4
0
        private IEnumerator DiveIn(Hand divingHand, float fadeTime)
        {
            yield return(new WaitForSeconds(fadeTime));

            // Fade the screen back in
            SteamVR_Fade.Start(Color.clear, currentFadeTime);

            // Fix the current position
            diveOutPos = player.trackingOriginTransform.position;
            diveOutRot = player.trackingOriginTransform.rotation;

            // Scale down the agent using the inverse of the scaling factor
            player.transform.localScale *= (1f / nextDT.scaleFactor);

            // Update the position of the agent
            //Vector3 feetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
            player.trackingOriginTransform.position = nextDT.divePos.position;// + feetOffset;

            //update the rotation to match divePos
            Debug.Log("Rotation update " + nextDT + " " + nextDT.divePos + " " + nextDT.divePos.rotation, nextDT.divePos);
            player.trackingOriginTransform.rotation = nextDT.divePos.rotation;

            // Spawn the sword if necessary
            if (nextDT.swordTarget)
            {
                divingHand.Activate_sword();
            }
            //Activate the bow if necessary
            if (nextDT.archeryTarget)
            {
                nextDT.ActivateBow();
            }

            // Finish the dive process
            currentDT = nextDT;
            nextDT    = null;
            diving    = false;
            //Start Battle Music
            SoundManagerScript.S.StopPlayroomSound();
            SoundManagerScript.S.MakeBattleSound();
        }