Ejemplo n.º 1
0
 public GameSession(PlayerCharacterData character, LevelData level)
 {
     m_mainCharacter = new PlayerCharacter(character, this);
     m_level         = new LevelSession(level);
     m_state         = EGameSessionSate.PreGame;
     m_result        = new GameSessionResult();
 }
Ejemplo n.º 2
0
    public void UpdateSession()
    {
        if (m_state == EGameSessionSate.PreGame)
        {
        }
        else if (m_state == EGameSessionSate.Running)
        {
            EInputAction action = m_inputListener.UpdateListener();
            m_mainCharacter.Update();
            m_mainCharacter.UpdateAction(action);
            for (int i = 0, count = m_enemies.Count; i < count; i++)
            {
                m_enemies[i].Update();
            }

            CheckCollectables();

            if (CheckWinConditions())
            {
                m_result.SessionWon = true;
                m_state             = EGameSessionSate.PostGame;
                m_sessionFinished   = true;
                m_mainCharacter.Entity.StopAll();
            }

            if (CheckFailCondition())
            {
                m_result.SessionWon = false;
                m_state             = EGameSessionSate.PostGame;
                m_sessionFinished   = true;
                m_mainCharacter.Entity.StopAll();
            }
        }
        else if (m_state == EGameSessionSate.PostGame)
        {
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Start the current session so the user can move the character.
 /// </summary>
 public void StartSession()
 {
     m_state = EGameSessionSate.Running;
     m_inputListener.SetEnableListener(true);
     CameraManager.Instance.FollowTarget(m_mainCharacter.Entity.gameObject, m_levelEntity.LeftBound.position.x, m_levelEntity.RightBound.position.x);
 }