Exemple #1
0
    private void Start()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        m_PlayerTransform = player.transform;
        m_PlayerMovement  = m_PlayerTransform.GetComponent <MovingObject>();
        RoomInfo firstRoom = GameObject.FindGameObjectWithTag("FirstRoom").GetComponent <RoomInfo>();

        m_CurrentMinX = firstRoom.GetMinX();
        m_CurrentMaxX = firstRoom.GetMaxX();
        m_CurrentMinY = firstRoom.GetMinY();
        m_CurrentMaxY = firstRoom.GetMaxY();
    }
Exemple #2
0
    private IEnumerator TransitionRoutine()
    {
        new GameFlowEvent(EGameFlowAction.StartTransition).Push();
        // Teleport the player to the nex room
        m_PlayerTransform.position = new Vector3(m_PlayerNode.position.x, m_PlayerTransform.position.y, m_PlayerTransform.position.z);
        m_PlayerMovement.Freeze();

        yield return(new WaitForSecondsRealtime(m_TransitionTime));

        m_CurrentMinX = m_EnterRoom.GetMinX();
        m_CurrentMaxX = m_EnterRoom.GetMaxX();
        m_CurrentMinY = m_EnterRoom.GetMinY();
        m_CurrentMaxY = m_EnterRoom.GetMaxY();
        m_EnterRoom.gameObject.SetActive(true);
        RoomEnemy enemies = m_EnterRoom.GetComponent <RoomEnemy>();

        if (enemies != null)
        {
            enemies.ResetEnemies();
        }
        m_ExitRoom.gameObject.SetActive(false);
        m_PlayerMovement.Unfreeze();
        new GameFlowEvent(EGameFlowAction.EndTransition).Push();
    }