timerreset

hi guys i want to reset the timer if player hits an enemy i made health bar and made it reduces when hitting an enemy and the player re spawn at the start but timer doesn’t reset it continues counting down but i need it to be reset to give the player to the ability to finish the level since it will be so hard for him to pass the level with that low time left so i want u to help here is my script

using UnityEngine;

using System.Collections;

using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{

public float startTime;
private string currentTime;

private bool Completed = false;
void Update()
{
    if (!Completed)
    {
        startTime -= Time.deltaTime;
        currentTime = string.Format("{0:0.0}", startTime);
        if (startTime <= 0)
        {
            startTime = 0;

            Application.LoadLevel(1);
        }
    }
}
public void Timerreset()
    {   startTime=   Time.time ; }

What are you planning on doing, sitting next to each player and inputting the score as they get to a new level?

You have to set this in script now it doesn’t really take that much imagination to go from …

          if (startTime <= 0)
          {
              startTime = 15;
              Application.LoadLevel(1);
          }

When you want to restart level 1 to …

              startTime = 30;
              Application.LoadLevel(2);

Just set your startTime before you load each level.

okay i will try after i solve my problem 1st i hope u help me idk whats wrong with it