Пример #1
0
    private void SetSailsToState(SailingState _state)
    {
        // Sail state can be set to slow if it's build mode
        if (_state == SailingState.SLOW)
        {
            if (!GameState.BuildMode)
            {
                AudioManager.instance.PlaySound(slowDownSound);
            }

            UI.GoingFast(false);

            components.LowerSails();
        }

        // the other two states cannont be accessed if it's in build mode
        if (!GameState.BuildMode)
        {
            if (_state == SailingState.IDLE)
            {
                components.RaiseSails();

                components.FullSpeed(false);
                UI.GoingFast(false);
                CC.DisableFastMode();
            }
            else if (_state == SailingState.SLOW)
            {
                CC.DisableFastMode();
                UI.GoingFast(false);

                components.FullSpeed(false);
            }
            else if (_state == SailingState.FAST)
            {
                AudioManager.instance.PlaySound(fullSpeedSound);

                components.LowerSails();

                components.FullSpeed(true);

                UI.GoingFast(true);

                CC.EnableFastMode();
            }
        }
    }