示例#1
0
    private DialogEffectBase SetNewEffect(DialogEffectBase effect)
    {
        if (effect == null)
        {
            return(null);
        }

        DialogEffectBase newEffect = Instantiate(effect);

        newEffect.SetUpEffect(this);
        return(newEffect);
    }
示例#2
0
    private void SetBoxSettings(DialogBoxObject boxObject)
    {
        if (_currentColorEffect != null && (boxObject.StopColorEffect || boxObject.ColorEffect != null))
        {
            _currentColorEffect.ResetEffect();
            _currentColorEffect = null;
        }
        if (_currentShakeEffect != null && (boxObject.StopShakeEffect || boxObject.ShakeEffect != null))
        {
            _currentShakeEffect.ResetEffect();
            _currentShakeEffect = null;
        }

        if (_currentColorEffect == null)
        {
            _currentColorEffect = (DialogEffectColor)SetNewEffect(boxObject.ColorEffect);
        }
        if (_currentShakeEffect == null)
        {
            _currentShakeEffect = (DialogEffectShake)SetNewEffect(boxObject.ShakeEffect);
        }

        if (boxObject.Effects != null)
        {
            for (int i = 0; i < boxObject.Effects.Length; i++)
            {
                DialogEffectBase newEffect = SetNewEffect(boxObject.Effects[i]);
                if (newEffect != null)
                {
                    _currentEffects.Add(newEffect);
                }
            }
        }

        if (boxObject.BackgroundSprite != null && _backgroundImage != null)
        {
            _backgroundImage.sprite = boxObject.BackgroundSprite;
        }

        SetCharacterSettings(boxObject.RightCharacter, _rightImage, boxObject.RightTalking, _rightNameBox, _rigthNameText);
        SetCharacterSettings(boxObject.LeftCharacter, _leftImage, !boxObject.RightTalking, _leftNameBox, _leftNameText);

        _textAudioSource.Play();
    }