示例#1
0
    public void LevelCleared()
    {
        _score._levelUp = false;
        _score.ResetPoints();
        if (_currentLevel <= 2)
        {
            _currentLevel = _levelGeneration.GenerateLevel();
        }
        else
        {
            _winScreen.gameObject.SetActive(true);
            Time.timeScale = 0;
        }

        //Temporary for FSM state switch test
        if (Vector2.Distance(enemyObject.transform.position, playerObject.transform.position) > 0.5)
        {
            _enemyStateMachine.SwitchState(EnemyStateType.Idle);

            Debug.Log(playerObject.transform.position);
        }

        if (Vector2.Distance(enemyObject.transform.position, playerObject.transform.position) <= 0.5)
        {
            _enemyStateMachine.SwitchState(EnemyStateType.Attack);
        }
        _enemyStateMachine.Update();
    }
示例#2
0
    public void LevelCleared()
    {
        _score._levelUp = false;
        _score.ResetPoints();
        if (_currentLevel <= 2)
        {
            _currentLevel = _levelGeneration.GenerateLevel();
        }
        else
        {
            _winScreen.gameObject.SetActive(true);
            TextMeshProUGUI endText = _winScreen.gameObject.GetComponentInChildren <TextMeshProUGUI>();
            _screenText.text = "You did it!";
            Time.timeScale   = 0;
        }

        //Temporary for FSM state switch test
        //if (Vector2.Distance(_enemyObject.transform.position, _playerObject.transform.position) > 0.5 )
        //{
        //    _enemyStateMachine.SwitchState(EnemyStateType.Idle);
        //
        //    Debug.Log(_playerObject.transform.position);
        //}
        //
        //if (Vector2.Distance(_enemyObject.transform.position, _playerObject.transform.position) <= 0.5)
        //{
        //    _enemyStateMachine.SwitchState(EnemyStateType.Attack);
        //}
        //_enemyStateMachine.Update();
    }