// Update is called once per frame void Update() { if (gvrStatus) { gvrTime = gvrTime + Time.deltaTime; timeGo = gvrTime; loader.fillAmount = gvrTime / totalTime; } if (timeGo > 2) { loader.fillAmount = 0; MoveScriptAB moveToTemple1 = new MoveScriptAB(); Vector3 playerPos = player.transform.position; Vector3 targetpos = playerTarget3[0].transform.position; moveToTemple1.MoveObject(player, playerPos, targetpos, speed); } Vector3 init = player.transform.position; Vector3 fin = playerTarget3[0].transform.position; Debug.Log(Vector3.Distance(init, fin)); if (Vector3.Distance(init, fin) < 0.5) { miniStepCounter = 1; Debug.Log(miniStepCounter); player.GetComponent <StepToTemple2>().enabled = true; player.GetComponent <StepToTemple1>().enabled = false; } }
public void TeleportPlayerAtoB() { Vector3 initPosPlayer1 = player.transform.position; Vector3 targetPosPlayer1 = targetPlayer1.transform.position; MoveScriptAB teleportPlayer1 = new MoveScriptAB(); teleportPlayer1.MoveObject(player, initPosPlayer1, targetPosPlayer1, speed); }
public void MoveSubstep() { MoveScriptAB substep0 = new MoveScriptAB(); Vector3 initPos = player.transform.position; Vector3 targetPos = playerTarget2.transform.position; substep0.MoveObject(player, initPos, targetPos, speed); }
// Update is called once per frame void Update() { if (gvrStatus) { gvrTime = gvrTime + Time.deltaTime; loader.fillAmount = gvrTime / totalTime; } if (gvrTime > 2) { gvrTimeGo = gvrTime; } Debug.Log("gvrTime is " + gvrTimeGo); if (gvrTimeGo > 2) { mapImage[i].SetActive(false); player.GetComponent <StepToTemple2>().enabled = false; Vector3 playerPos = player.transform.position; // Vector3 targetPos = playerTarget[i].transform.position; /*if (Vector3.Distance(playerPos, targetPos) < 0.5) * { * i = i + 1; * } */ Vector3 targetPosNew = playerTarget[i].transform.position; MoveScriptAB teleportPlayerToTemple = new MoveScriptAB(); teleportPlayerToTemple.MoveObject(player, playerPos, targetPosNew, speed); GvrOff(); loader.fillAmount = 0; gvrStatus = false; Debug.Log("destance is " + Vector3.Distance(playerPos, targetPosNew)); if (Vector3.Distance(playerPos, targetPosNew) < 0.5) { Debug.Log("kill gvrTimego"); gvrTimeGo = 0; i = i + 1; } } }
// Update is called once per frame void Update() { Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0.0f)); if (Physics.Raycast(ray, out _hit, rayCastDistance)) { } gameTime = gameTime + Time.deltaTime; pause = pause + Time.deltaTime; if (StatementCount == 0 & pause > 2.0f) { PlayAudio playFirstAudio = new PlayAudio(); playFirstAudio.PlayThisAudio(firstStatement); if (gameTime > firstStatement.clip.length) { StatementCount = 1; pause = 0.0f; Debug.Log("statement 1 complete"); } } if (StatementCount == 1 & pause > 2.0f) { Debug.Log("Pause is " + pause); MoveScriptAB moveGuide = new MoveScriptAB(); Vector3 init1Guide = guide.transform.position; Vector3 target1Guide = targetObject.transform.position; moveGuide.MoveObject(guide, init1Guide, target1Guide, speed); Vector3 init1Player = player.transform.position; Vector3 target1Player = player1target.transform.position; moveGuide.MoveObject(player, init1Player, target1Player, speed); gameObject.GetComponent <PlayerMovement>().enabled = true; ResetTime resetTime1 = new ResetTime(); resetTime1.Reset(pause); Debug.Log("pause is " + pause); } }
// Update is called once per frame void Update() { if (gvrStatus) { gvrTime = gvrTime + Time.deltaTime; timeGo = gvrTime; loader.fillAmount = gvrTime / totalTime; } if (timeGo > 2) { loader.fillAmount = 0; player.GetComponent <StepToTemple1>().enabled = false; MoveScriptAB moveToTemple2 = new MoveScriptAB(); Vector3 playerPos = player.transform.position; Vector3 targetpos = playerTarget4.transform.position; moveToTemple2.MoveObject(player, playerPos, targetpos, speed); } }
// Update is called once per frame void Update() { gameTime = gameTime + Time.deltaTime; if (statementCount == 0) { player.GetComponent <SelectGameScript>().enabled = false; PlayThisAudioStatement(statement1); //Invoke("StatementPlay" , 2); statementCount = statementCount + 1; } if (gameTime > statement1.length & statementCount == 1 & rotateCount == 0) { guide.transform.Rotate(0, 180, 0, Space.Self); rotateCount = 1; } if (gameTime > statement1.length & statementCount == 1) { MoveScriptAB teleport = new MoveScriptAB(); Vector3 initGuide1 = guide.transform.position; Vector3 guideTargetPos1 = guideTarget1.transform.position; teleport.MoveObject(guide, initGuide1, guideTargetPos1, speed); gameObject.GetComponent <NewGazeScript>().enabled = true; teleportImage1.SetActive(true); } Vector3 guidePosition = guide.transform.position; Vector3 guideTargetPosition = guideTarget1.transform.position; float distanceGuideArtifact = Vector3.Distance(guidePosition, guideTargetPosition); if (distanceGuideArtifact < 0.5 & rotateCount == 1) { guide.transform.Rotate(0, 180, 0, Space.Self); rotateCount = 2; } //guide reached at the position of artifact //gazeImage foot appeared on the screen //statement 1 played //Guide reached near artifact //player reached near artifact //coding for: if player distance less than minDistanceArtifact than play statement 2 and statementCount is equal to 2 Vector3 playerPosition = player.transform.position; Vector3 playerTargetPosition = playerTarget1.transform.position; float distancePlayerArtifact = Vector3.Distance(playerPosition, playerTargetPosition); Debug.Log(distancePlayerArtifact); if (distancePlayerArtifact < 0.5 & statementCount == 1) { pauseTime = pauseTime + Time.deltaTime; // play statement 2 - give instructions to choose artifact ; if (pauseTime > 2) { PlayThisAudioStatement(statement2); statementCount = statementCount + 1; } } // statement two complete now user has to choose artifact if (statementCount == 2) { for (int i = 0; i < 4; i++) { state[i] = !artifact[i].activeInHierarchy; } if (state[0] & state[1] & state[2] & state[3]) { loadingImage.fillAmount = 0.0f; PlayThisAudioStatement(statement3); statementCount = statementCount + 1; Debug.Log(statementCount); statement3Time = gameTime; } } if (statementCount == 3 & gameTime - (statement3Time + statement3.length) > 2 & rotateCount == 2) { guide.transform.Rotate(0, 180, 0, Space.Self); rotateCount = 3; } Vector3 guide2Position = guide.transform.position; Vector3 guide2TargetPosition = guideTarget2.transform.position; float distanceGuide2Artifact = Vector3.Distance(guide2Position, guide2TargetPosition); if (distanceGuide2Artifact < 0.5 & rotateCount == 3) { guide.transform.Rotate(0, 180, 0, Space.Self); rotateCount = 4; } if (statementCount == 3 & gameTime - (statement3Time + statement3.length) > 2) { MoveScriptAB teleportGuide2 = new MoveScriptAB(); Vector3 initialGuidePos = guide.transform.position; Vector3 guideTargetPos2 = guideTarget2.transform.position; teleportGuide2.MoveObject(guide, initialGuidePos, guideTargetPos2, speed); step2TeleportImage.SetActive(true); player.GetComponent <StepTowardsPrasad>().enabled = true; player.GetComponent <NewGazeScript>().enabled = false; } if (statementCount == 3) { Vector3 playerPos = player.transform.position; Vector3 targetPos = playerTarget2.transform.position; if (Vector3.Distance(targetPos, playerPos) < 0.05) { PlayThisAudioStatement(statement4); statementCount = 4; } } // statement 3 played, now user has to move towards temple if (statementCount == 4) { for (int i = 0; i < 4; i++) { statePrasad[i] = !prasad[i].activeInHierarchy; } if (statePrasad[0] & statePrasad[1] & statePrasad[2] & statePrasad[3]) { PlayThisAudioStatement(statement5); statementCount = 5; statement5Time = gameTime; } } // code to move guide from Prasad to 1st corner if (statementCount == 5 & gameTime - (statement5Time + statement5.length) > 2 & subStepToTemple != 1 & rotateCount == 4) { guide.transform.Rotate(0, 180, 0, Space.Self); rotateCount = 5; Debug.Log("guide rotating " + rotateCount + "times"); } if (statementCount == 5 & gameTime - (statement5Time + statement5.length) > 2 & subStepToTemple != 1 & rotateCount == 5) { MoveScriptAB teleportGuide3 = new MoveScriptAB(); Vector3 initialGuidePos = guide.transform.position; Vector3 guideTargetPos3 = guideTarget3.transform.position; teleportGuide3.MoveObject(guide, initialGuidePos, guideTargetPos3, speed); step3TeleportImage.SetActive(true); player.GetComponent <StepTowardsPrasad>().enabled = false; player.GetComponent <StepToTemple1>().enabled = true; // code to move guide from corner1 to nect position Vector3 initGuide = guide.transform.position; Vector3 subStepGuide = guideTarget3.transform.position; if (Vector3.Distance(initGuide, subStepGuide) < 0.05) { Debug.Log("guide has reached the corner"); decesion1Image.SetActive(true); } Vector3 initPlayer1 = player.transform.position; Vector3 finalPlayer1 = playerTarget3.transform.position; if (Vector3.Distance(initPlayer1, finalPlayer1) < 0.05) { PlayThisAudioStatement(statement6); statementCount = 6; subStepToTemple = 1; } } if (statementCount == 6) { Vector3 initPlayer = player.transform.position; Vector3 targetPlayer = templeGate.transform.position; if (Vector3.Distance(initPlayer, targetPlayer) < 0.5) { PlayThisAudioStatement(ganeshBhagwanAudio); statementCount = 7; } } if (statementCount == 7) { Vector3 initPlayer = player.transform.position; Vector3 targetPlayer = finalTarget.transform.position; if (Vector3.Distance(initPlayer, targetPlayer) < 0.05) { mapToTemple.SetActive(false); PlayThisAudioStatement(statement7); statementCount = 8; endGameCanvas.SetActive(true); } } }