// Update is called once per frame void Update() { GameScore = GameManager_Scoring.GetInstance().GetGameScore(); currentTimer -= Time.deltaTime; // Update the sprite size HPBarSpriteRenderer.size = new Vector2(HPBarSpriteInitialWidth * currentTimer / GameRoundTime, HPBarSpriteInitialHeight); if (currentTimer <= 0.0) { currentTimer = 0.0f; } TextMeshObject.text = "Nostalgia Points: " + string.Format("{0:N0}", GameScore); //+ "\nCountdown: " + string.Format("{0:N0}", currentTimer) }
public void OnAction() { // Only change the score if ActionCalled was initially off if (ActionCalled == false) { GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue); } // Action to be called by the operator // When the action is called, it will apply a force to the plate ActionCalled = true; GetComponent <Rigidbody>().AddRelativeForce(ForceVector); SoundManager.instance.RandomizeSfx(actionSound1, actionSound2); }
// Action to be called by the operator // When the action is called, it will apply a force to the plate public void OnAction() { // Only change the score if ActionCalled was initially off if (ActionCalled == false) { GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue); } ActionCalled = true; Vector3 Force = new Vector3(0.0f, 30.0f, 0.0f); Vector3 Position = new Vector3(0.75f, 0.0f, 0.75f); TableRigidBody.AddForceAtPosition(Force, Position); SoundManager.instance.RandomizeSfx(actionSound1, actionSound2); }
public void OnAction() { // Put in OnAction() function SoundManager.instance.PlayLoop(LoopSound); SoundManager.instance.RandomizeSfx(actionSound1, actionSound2); // Only change the score if ActionCalled was initially off if (ActionCalled == false) { GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue); } // Action to be called by the operator ActionCalled = true; // Trigger the particle emitter ParticleObject.SetActive(true); }
public void OnAction() { // Each time action is called, decrease the health of the object if (ObjectHealth > 0) { // Update the object health ObjectHealth--; // Update the sprite size HPBarSpriteRenderer.size = new Vector2(HPBarSpriteInitialWidth * ObjectHealth / ObjectInitialHealth, HPBarSpriteInitialHeight); if (ObjectHealth <= (0.25 * ObjectInitialHealth)) { HPBarSpriteRenderer.color = Color.red; } // Update the text of the text box TextMeshObject.text = string.Format("{0:N0}", ObjectHealth) + " NP"; } if (ObjectHealth == 0) { // Only change the score if ActionCalled was initially off if (ActionCalled == false) { GameManager_Scoring.GetInstance().AddToScore(DestroyedObjectScoreValue); } // Action to be called by the operator ActionCalled = true; // Trigger the particle emitter ParticleObject.SetActive(false); ParticleObject.SetActive(true); // Trigger sound file SoundManager.instance.RandomizeSfx(actionSound); } }
private void Update() { currentTimer -= Time.deltaTime; if (doSwitch && currentTimer < 0f && !credit) { credit = true; SceneManager.LoadScene("CreditsScreen"); } if ((Input.GetButtonDown("ChangeToParent") || currentTimer < 0f) && doSwitch == false) { KidControls kidControls = (KidControls)FindObjectOfType(typeof(KidControls)); // If we are already in parent mode do nothing if (kidControls.recording == false && kidControls.replaying == true) { return; } history_backup = new List <KidControls.SimpleTransform>(); foreach (KidControls.SimpleTransform item in kidControls.history) { history_backup.Add(item); } Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); doSwitch = true; currentTimer = 120f; } if (doSwitch) { frameCounter++; } if (frameCounter == 10) { currentTimer = 120f; KidControls kidControls = (KidControls)FindObjectOfType(typeof(KidControls)); KidControls kidControlsNewScene = (KidControls)FindObjectOfType(typeof(KidControls)); ParentManualControls parentControls = (ParentManualControls)FindObjectOfType(typeof(ParentManualControls)); AI_Ctrl ai_ctrl = (AI_Ctrl)FindObjectOfType(typeof(AI_Ctrl)); if (kidControlsNewScene != null) { kidControls.history = history_backup; kidControlsNewScene.recording = false; kidControlsNewScene.replaying = true; } if (parentControls != null) { parentControls.activateManualControls = true; var navMesh = parentControls.gameObject.GetComponent <NavMeshAgent>(); if (navMesh != null) { navMesh.enabled = false; } } if (ai_ctrl != null) { ai_ctrl.enableParent = false; var bc = ai_ctrl.GetComponent <BoxCollider>(); if (bc != null) { bc.enabled = true; } var cc = ai_ctrl.GetComponent <CapsuleCollider>(); if (cc != null) { cc.enabled = true; } } GameManager_Scoring.GetInstance().isAdult = true; } }