Ejemplo n.º 1
0
    private void AddLevelClearManager()
    {
        LevelClearManager manager = GetComponent <LevelClearManager>();

        if (manager == null)
        {
            gameObject.AddComponent <LevelClearManager>();
        }
    }
Ejemplo n.º 2
0
 public static void LevelClear(float timeInSeconds)
 {
     if (instance == null)
     {
         GameObject gameOverScreenObject = (GameObject)Resources.Load(LEVEL_CLEAR_SCREEN_PATH);
         GameObject instantiated         = Instantiate(gameOverScreenObject);
         DontDestroyOnLoad(instantiated);
         instance = instantiated.GetComponent <LevelClearManager>();
     }
     instance.ShowLevelClearScreen(timeInSeconds);
 }
Ejemplo n.º 3
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        ThingToProtect thingToProtect = collision.gameObject.GetComponent <ThingToProtect>();

        if (thingToProtect != null)
        {
            if (Time.frameCount - LevelClearManager.lastActivateFrame > 15)
            {
                LevelClearManager.lastActivateFrame = Time.frameCount;
                //if (Player.mainPlayer.handController.HasThingToProtect()) {
                AudioManager.Instance.PlayWinSound();
                LevelClearManager.LevelClear(Time.time - startTime);
                thingToProtect.transform.SetParent(flowerPosition, false);
                thingToProtect.transform.localPosition = new Vector3(0, 0, 0);
                thingToProtect.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 90));
                //}
            }
        }
    }