Ejemplo n.º 1
0
 public void Awake()
 {
     chainedPuzzleInstance = GetComponentInChildren <ChainedPuzzleInstance>();
     id    = chainedPuzzleInstance.GetInstanceID();
     sound = new CellSoundPlayer(new Vector3(transform.position.x, transform.position.y + 50, transform.position.z));
     //lightCollection = LG_LightCollection.Create(chainedPuzzleInstance.m_sourceArea.m_courseNode, new Vector3(0, 0, 0), LG_LightCollectionSorting.Distance, float.MaxValue);
     Patch_StateChange.OnInteract += onStateChange;
 }
Ejemplo n.º 2
0
        private void Update()
        {
            if (!SNet.LocalPlayer.HasPlayerAgent || PlayerChatManager.InChatMode)
            {
                return;
            }
            PlayerAgent playerAgent = SNet.LocalPlayer.PlayerAgent.Cast <PlayerAgent>();

            if (_soundPlayer == null)
            {
                if (_soundPlayerDummy != null)
                {
                    Destroy(_soundPlayerDummy);
                }
                _soundPlayerDummy = new GameObject();
                _soundPlayerDummy.transform.position = playerAgent.Position;
                _soundPlayer = new CellSoundPlayer(playerAgent.Position);
                Log.Info($"Created CSP at Position: [{_soundPlayerDummy.transform.position.x}, {_soundPlayerDummy.transform.position.y}, {_soundPlayerDummy.transform.position.z}]");
                _soundPlayerMarker = GuiManager.NavMarkerLayer.PrepareGenericMarker(_soundPlayerDummy);
                SoundId            = 0;
            }
            if (Input.GetKeyDown(KeyCode.K))
            {
                _soundPlayer.UpdatePosition(playerAgent.Position);
                _soundPlayerDummy.transform.position = playerAgent.Position;
                Log.Info($"Moved CSP to Position: [{_soundPlayerDummy.transform.position.x}, {_soundPlayerDummy.transform.position.y}, {_soundPlayerDummy.transform.position.z}]");
            }
            if (Input.GetKeyDown(KeyCode.L))
            {
                if (_soundPlayer != null)
                {
                    _soundPlayer.Stop();
                }
                else
                {
                    Log.Error($"Attempting to stop sound without a CSP object");
                }
            }
            if (Input.GetKeyDown(KeyCode.P))
            {
                if (_soundPlayer != null)
                {
                    _soundPlayer.Post(SoundId);
                }
                else
                {
                    Log.Error($"Attempting to play sound without a CSP object");
                }
            }
            if (Input.GetKeyDown(KeyCode.Insert))
            {
                _guiEnabled = !_guiEnabled;
                Log.Info($"Toggled GUI to {_guiEnabled}");
            }
        }