// Update is called once per frame void Update() { PlayerScript PlayerScript = GetComponent <PlayerScript>(); TimeTravelIndicator TimeTravelIndicator = GetComponent <TimeTravelIndicator>(); if (frameNum % framerate == 0) //every big frame, record the player's actions { bool didSword = PlayerScript.didSword; bool didShoot = PlayerScript.didShoot; CloneLocation toAdd = new CloneLocation(transform.position, playerRotation.transform.rotation.eulerAngles, didSword, didShoot); if (didShoot) { PlayerScript.didShoot = false; } if (didSword) { PlayerScript.didSword = false; } locations.Add(key, toAdd); //Add the player's current location to the locations map key++; //The location's number } frameNum++; int charge = PlayerScript.getCharges(); if (charge >= currLevelCharges()) //go back in time { newClone = Instantiate(clone); //create the clone PlayerScript.resetCharges(); //set charges to 0 TimeTravelIndicator.setFlash("white"); //flashes the screen white Resetter resetter = nonPlayerObjects.GetComponent <Resetter>(); //resets the location of everything resetter.reset = true; bucket.GetComponent <BucketScript>().reset(); //resets the bucket's status timer.GetComponent <Timer>().reset(); //resets the timer locations.Add(key, DESTROY_CLONE); //Adds a marker - the past self should be destroyed here key++; } if ((newClone != null) && (frameNum % framerate == 0)) //every big frame, update the clone { CloneLocation toSet = (CloneLocation)locations[key2]; CloneScript cloneScript = newClone.GetComponent <CloneScript>(); if (!PlayerScript.getPause()) //Pauses the clone { cloneScript.setLocation(toSet); //set the clone's location key2++; } } }
//KILL THE PLAYER WITHOUT THE DRAMATIC LIGHT DIMMING public void instaKill() { TimeTravelIndicator TimeTravelIndicator = GetComponent <TimeTravelIndicator>(); TimeTravelIndicator.setFlash("black"); Application.LoadLevel("DeathScene"); }
//KILL THE PLAYER WITH DRAMA //Literally the most satisfying function in this entire project. public void kill() { TimeTravelIndicator TimeTravelIndicator = GetComponent <TimeTravelIndicator>(); TimeTravelIndicator.setFlash("black"); Debug.Log("deathhhhh"); //ValueHolder.currentTime = time; //Dim the lights dramatically coroutine = LightChange(); StartCoroutine(coroutine); }