Exemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(TagManager.GetTag(TagType.MovingPoint)))
        {
            if (_movementPoints[_currentPointNum].NeedToRotate)
            {
                RotatePlayer(_movementPoints[_currentPointNum].RotationVector);
            }
            if (_movementPoints[_currentPointNum].NeedToChangeSpeed)
            {
                _speed = _movementPoints[_currentPointNum].NewSpeed;
            }
            if (_movementPoints[_currentPointNum].Enemyes.Length == 0)
            {
                ChangePoint();
            }
            else
            {
                _mainGameController.ActivateEnemyes(_movementPoints[_currentPointNum].Enemyes, _movementPoints[_currentPointNum].NeedToCountEnemy);
                if (_movementPoints[_currentPointNum].NeedToCountEnemy)
                {
                    _needToMove = false;
                }
                else
                {
                    ChangePoint();
                }
                if ((_movementPoints[_currentPointNum].IsFinalPoint))
                {
                    _mainGameController.LevelIsEnded();
                }
            }

            if (_currentPointNum < _movementPoints.Length && (_movementPoints[_currentPointNum].IsFinalPoint) && _movementPoints[_currentPointNum].Enemyes.Length == 0)
            {
                _mainGameController.LevelIsEnded(true);
            }
            Destroy(other.gameObject);            //что бы лишних колайдеров на сцене не было
        }
    }