public void SetPlayerAndBlocksPosition() { if (currentBlocks != null && currentTemple != null && player != null) { player.SetPosition(currentTemple.ComputePlayerPosition(timelinePercentage)); currentBlocks.SetPosition(currentBlocks.ComputeBlocksPosition(timelinePercentage)); } if (timelinePercentage > 0.99f && onReachEnd != null) { onReachEnd(); } if (currentBlocks == null) { currentBlocks = FindObjectOfType <BlocksRoot>(); } if (currentTemple == null) { currentTemple = FindObjectOfType <TempleRoot>(); } if (player == null) { player = FindObjectOfType <Player>(); } }
private void GetReferences() { if (hole == null) { hole = FindObjectOfType <Hole>(); } if (temple == null) { temple = FindObjectOfType <TempleRoot>(); } if (player == null) { player = FindObjectOfType <Player>(); } }
void Update() { if (currentBlocksRoot == null) { currentBlocksRoot = FindObjectOfType <BlocksRoot>(); } if (!placed) { if (temple == null) { temple = FindObjectOfType <TempleRoot>(); } if (temple != null) { this.transform.position = temple.endPosition.position + tableOffsetFromFinalPosition; placed = true; } } // DEBUG if (push) { PushButton(pushnb); push = false; if (Application.isEditor) { if (HasRightCombination()) { Debug.Log("YOU WIN"); } if (HasMadeTooManyMistakes()) { Debug.Log("YOU LOOSE"); } } } if (restart) { restart = false; OnRestartLevel(); } }