Пример #1
0
 public void LevelClearCondition()
 {
     // Enable teleporters
     teleportersExit.GetComponent <TeleporterManager>().EnableTeleporters();
     IsSublevelComplete = true;
     OnLevelComplete?.Invoke(this, EventArgs.Empty);
 }
Пример #2
0
    private void onBoxMovement(Vector2Int pBoxStartPosition, Vector2Int pBoxTargetPosition)
    {
        if (_boxHolderDictionary.ContainsKey(pBoxStartPosition))
        {
            if (_boxHolderDictionary[pBoxStartPosition] == true)
            {
                _capturedBoxesCount--;
                _boxHolderDictionary[pBoxStartPosition] = false;
            }
        }
        bool lIsBoxInPlace = false;

        if (_boxHolderDictionary.ContainsKey(pBoxTargetPosition))
        {
            if (_boxHolderDictionary[pBoxTargetPosition] == false)
            {
                _capturedBoxesCount++;
                _boxHolderDictionary[pBoxTargetPosition] = true;
                _particleSystem.transform.position       = new Vector3(pBoxTargetPosition.x + 0.5f, pBoxTargetPosition.y + 0.5f, 0f);
                _particleSystem.Play();
                lIsBoxInPlace = true;
            }
        }

        if (_capturedBoxesCount == _boxHolderDictionary.Count)
        {
            AudioManager.Instance.Play("LevelFinished");
            OnLevelComplete?.Invoke();
        }
        else if (lIsBoxInPlace)
        {
            AudioManager.Instance.Play("BoxInPlace");
        }
    }
    public void LevelComplete()
    {
        currentLevel++;
        OnLevelComplete?.Invoke();

        shouldStartNextLevel = true;
        timeToNextLevel      = 2;
    }
Пример #4
0
 //When the player enters the trigger, trigger what ever is tied to the onComplete event
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.transform.tag == "Player")
     {
         collision.transform.SendMessage("stopGame");
         onComplete.Invoke();
     }
 }
Пример #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         Destroy(gameObject);
         OnLevelComplete?.Invoke();
     }
 }
Пример #6
0
 public void CheckForLevelEnd()
 {
     if (PlayerShoot.enemiesTr.Count == 0)
     {
         OnLevelComplete?.Invoke();
         LoadNextLevel loadLevelScript = FindObjectOfType(typeof(LoadNextLevel)) as LoadNextLevel;
         loadLevelScript.OpenNextLevel();
     }
 }
Пример #7
0
 public void AddCakesPacked()
 {
     cakesPacked++;
     if (cakesPacked == 3)
     {
         Debug.Log("@@@@@@@@@ Truck is now packed @@@@@@@@@");
         OnLevelComplete?.Invoke(this, EventArgs.Empty);
     }
 }
Пример #8
0
    private void CompleteLevel()
    {
        Debug.Log("Level has been completed.");
        OnLevelComplete?.Invoke(LevelCompleteEventArgs);

        if (currentLevel.ID >= GameManager.Instance.HighestLevel)
        {
            GameManager.Instance.HighestLevel++;
        }
    }
    private void OnTriggerEnter(Collider other)
    {
        if (!(other.gameObject.name == "Ball"))
        {
            return;
        }
        OnLevelComplete?.Invoke();

        //TODO: SPAWN STARS
        //TODO: MOVE CAMERA
    }
Пример #10
0
 private void OnPlayerEnter(Collider collider)
 {
     if (isBossTeleporter)
     {
         OnLevelComplete?.Invoke(this, EventArgs.Empty);
     }
     if (destination != null)
     {
         // Teleport player
         collider.GetComponent <PlayerSystem>().SetLevel(destination);
     }
 }
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(GameTag.Player))
        {
            Time.timeScale = 0;

            //Invoke("loadNextLevel", m_time);
            StartCoroutine(loadNextLevel());
            if (OnLevelComplete != null)
            {
                OnLevelComplete.Invoke(new LevelCompleteZoneEventData(other.gameObject));
            }
        }
    }
Пример #12
0
 /// <summary>
 /// Called everytime a win condition is met. The condition GameObject is added to a list.
 /// When enough win conditions are met the level managers calls the LevelComplete event.
 /// A gameobject can only have one appearance in each list.
 /// </summary>
 private void WinConditionMet(GameObject condition)
 {
     if (!winConditionsList.Contains(condition))
     {
         winCounter++;
         winConditionsList.Add(condition);
         if (winCounter >= winConditionsToWin)
         {
             if (!levelAlreadyEnded)
             {
                 levelAlreadyEnded = true;
                 OnLevelComplete?.Invoke();
                 DestroyAllObjectsInScene(sceneObjects);
             }
         }
     }
 }
Пример #13
0
    void StartCountdown()
    {
        state    = SpawnStates.COUNTING;
        TimeLeft = timeBetweenWaves;



        if (nextWave > waves.Length - 2)
        {
            OnLevelComplete.Invoke();

            state = SpawnStates.WON;
        }
        else
        {
            nextWave++;
            onCountdown.Invoke();
        }

        waveCompleted = false;
    }
Пример #14
0
        public void InitiateLevelComplete()
        {
            animator.SetBool("success", true);

            OnLevelComplete?.Invoke();
        }
 private void Tp_OnLevelComplete(object sender, System.EventArgs e)
 {
     OnLevelComplete?.Invoke(sender, e);
 }
Пример #16
0
 private void LevelComplete()
 {
     OnLevelComplete?.Invoke();
     //SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
 }
Пример #17
0
 public void LevelComplete()
 {
     // Scene transition/UI overlay
     OnLevelCompletecallback.Invoke();
 }
Пример #18
0
 public static void LevelComplete()
 {
     OnLevelComplete?.Invoke();
 }