void Start() { int i; instance = this; window = Camera.main.transform; menu = FindObjectOfType <Menu>(); rider = FindObjectOfType <Rider>(); riders = FindObjectsOfType <Rider>(); graphics = FindObjectOfType <Graphics>(); puzzleGroups = FindObjectsOfType <PuzzleGroup>(); puzzleGroupIndex = 0; Array.Sort(puzzleGroups, new PuzzleGroupSorter()); puzzleGroup = puzzleGroups[puzzleGroupIndex]; puzzle = puzzleGroup.puzzles[puzzleGroup.puzzleIndex]; for (i = 0; i < puzzleGroups.Length; i++) { puzzleGroups[i].gameObject.SetActive(false); } puzzleGroup.gameObject.SetActive(true); puzzle.Activate(); switch (Application.platform) { case RuntimePlatform.WindowsPlayer: break; case RuntimePlatform.OSXPlayer: break; case RuntimePlatform.LinuxPlayer: break; } if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { mobile = true; menu.touchKeyboard = TouchScreenKeyboard.Open(graph.string1, TouchScreenKeyboardType.NumberPad, false); menu.showKeypad = true; } else { mobile = false; } if (Application.isWebPlayer) { Application.ExternalEval(String.Format("u.getUnity().SendMessage(\"{0}\", \"OnQueryString\", window.location.search);", gameObject.name)); } else if (Application.isEditor) { OnQueryString(startUrl); } Application.targetFrameRate = 60; }
void Update() { if (_activated == true) { if (_playerScr != null && _playerScr.Death.IsDead) { return; } if (Input.GetKeyDown(KeyCode.F)) { _puzzle.Activate(); _pickUpSFX.Play(); if (!_alwaysActive) { _deactivated = true; } if (_timeRestart == true) { StartCoroutine(Reset()); } if (_itemProvider != null && _playerScr != null) { _playerScr.GetComponent <PlayerInventoryList>().GetPuzzlePiece(_puzzlePieceNumber); _itemProvider.GiveItem(_playerScr); } if (_givesItem == true) { _playerScr.GetComponent <PlayerInventoryList>().GetPuzzlePiece(_puzzlePieceNumber); } if (_takesItem == true) { _playerScr.GetComponent <PlayerInventoryList>().GetPuzzlePiece(_emptyPieceNumber); } if (_givesMightyCube == true) { _playerScr.GetComponent <PlayerCubeCollection>().GetACube(_puzzlePieceNumber); } if (_pickupableObject != null && _playerScr != null) { _pickupableObject.Interact(_playerScr); } } } }
private void ActivatePuzzle() { if (puzzleToActivate == null) { return; } if (puzzleToActivate.Activated) { return; } puzzleToActivate.Activate(); }
public void SetGroup(int groupIndex) { puzzle.Deactivate(); puzzleGroup.gameObject.SetActive(false); puzzleGroupIndex = groupIndex; puzzleGroup = puzzleGroups[puzzleGroupIndex]; puzzleGroup.gameObject.SetActive(true); puzzle = puzzleGroup.puzzle; puzzleIndex = puzzleGroup.puzzleIndex; puzzle.Activate(); graph.string1 = puzzle.string1; cameraSmooth = false; StopRiding(); }
public void SetPuzzle(int newPuzzleIndex) { Debug.Log("Setting Puzzle " + newPuzzleIndex + " from " + puzzleIndex); //puzzle.Deactivate(); puzzle.gameObject.SetActive(false); puzzleIndex = newPuzzleIndex; puzzle = puzzles[puzzleIndex]; puzzle.gameObject.SetActive(true); puzzle.Activate(); game.puzzle = puzzle; game.puzzleIndex = puzzleIndex; puzzleListSelection = puzzleIndex; puzzleListContent[puzzleListContent.Length - 1] = new GUIContent(puzzle.puzzleName); puzzleListButtonContent = new GUIContent(puzzle.puzzleName); game.graph.string0 = puzzle.string0; game.graph.string1 = puzzle.string1; game.cameraSmooth = false; game.StopRiding(); Debug.Log("Current Puzzle: " + puzzleIndex); }