Beispiel #1
0
    void OnNights2StateChanged(object sender, Nights2Mgr.StateChangedEventArgs e)
    {
        if (_animator == null)
            return;

        for (int i = 0; i < Triggers.Length; i++)
        {
            if (Triggers[i].StateTrigger == e.NewState)
            {
                if(Triggers[i].AnimTriggerName.Length > 0)
                    _animator.SetTrigger(Triggers[i].AnimTriggerName);
            }
        }
    }
Beispiel #2
0
    void TeleportToWorld(GameObject world, Nights2Mgr.WorldID worldID)
    {
        Debug.Assert((world != null) && (Nights2Mgr.Instance.VRRig.transform != null));

        //just parent the VR rig to the new world, that's about it
        Transform vrTrans = Nights2Mgr.Instance.VRRig.transform;

        vrTrans.parent = world.transform;
        vrTrans.localPosition = Vector3.zero;
        vrTrans.localRotation = Quaternion.identity;

        Nights2Mgr.Instance.NotifyInWorld(worldID);
    }
Beispiel #3
0
    void OnNights2StateChanged(object sender, Nights2Mgr.StateChangedEventArgs e)
    {
        //OK, starting to follow a path
        if (e.NewState == Nights2Mgr.Nights2State.SeekingBeacon)
        {
            //reset portal state
            SetPortalState(PortalState.NoProgress);
            //reset treasure state too
            SetTreasureState(TreasureState.NoProgress);

            ShowPortal(false);
        }
        else
        {
            if (e.NewState != Nights2Mgr.Nights2State.NearBeacon) //we want portal state to still be "through exit portal"
                SetPortalState(PortalState.NoProgress);
            TeleportToWorld(Nights2Mgr.Instance.RoomWorld, Nights2Mgr.WorldID.RoomWorld);
        }
    }
Beispiel #4
0
 void OnTeleported(object sender, Nights2Mgr.TeleportedEventArgs e)
 {
     //cancel out of narration (and stop audio) if the player
       //teleports before its done
       //if (IsNarrationPlaying() && (e.NewWorld != Nights2Mgr.WorldID.RoomWorld))
       //{
       //   _narrationSound.Stop();
       //   _narrationStartTime = -1; //done tracking narration
       //}
 }
Beispiel #5
0
 void OnNights2StateChanged(object sender, Nights2Mgr.StateChangedEventArgs e)
 {
     if ((e.OldState == Nights2Mgr.Nights2State.GettingReady) && IsNarrationPlaying())
       {
      _narrationSound.Stop();
      _narrationStartTime = -1; //done tracking narration
       }
 }
Beispiel #6
0
    void OnNights2StateChanged(object sender, Nights2Mgr.StateChangedEventArgs e)
    {
        if ((e.NewState == Nights2Mgr.Nights2State.SeekingShamash) || (e.NewState == Nights2Mgr.Nights2State.FlameExtinguished))
        {
            //light up shamash spot
            if(Nights2SpotMgr.Instance != null)
                Nights2SpotMgr.Instance.MakeSpotActive(_closestSpot);

            _closeTimerLeft = MinTimeBeforeClose;

            //aim tunnel at player
            if (TunnelPivot != null)
            {
                Vector3 playerPos = GetTunnelTarget();
                TunnelPivot.LookAt(playerPos, Vector3.up);
                TunnelPivot.Rotate(Vector3.up, 180.0f); //oops, z axis in data is opposite of what it should be, so correct by 180 degrees
            }
        }
    }
Beispiel #7
0
 void Awake()
 {
     Instance = this;
 }