BattleText.InitSettings C# (CSharp) Method

InitSettings() private method

private InitSettings ( ) : bool
return bool
    private bool InitSettings()
    {
        bool init = false;
        if(this.settings != null && this.settings.active)
        {
            this.color = DataHolder.Color(this.settings.color);
            if(this.settings.showShadow) this.shadowColor = DataHolder.Color(this.settings.shadowColor);

            if(this.settings.fadeIn)
            {
                this.alpha = this.settings.fadeInStart;
                this.color.a = this.alpha;
                if(this.settings.showShadow) this.shadowColor.a = this.alpha;
                this.inDistance = this.settings.fadeInEnd - this.settings.fadeInStart;
                this.interpolateIn = Interpolate.Ease(this.settings.fadeInInterpolate);
            }

            if(this.settings.fadeOut)
            {
                this.outDistance = this.settings.fadeOutEnd - this.settings.fadeOutStart;
                this.interpolateOut = Interpolate.Ease(this.settings.fadeOutInterpolate);
            }

            if(this.settings.localSpace)
            {
                this.transform.localPosition += this.settings.baseOffset+new Vector3(
                        Random.Range(this.settings.randomOffsetFrom.x, this.settings.randomOffsetTo.x),
                        Random.Range(this.settings.randomOffsetFrom.y, this.settings.randomOffsetTo.y),
                        Random.Range(this.settings.randomOffsetFrom.z, this.settings.randomOffsetTo.z));
            }
            else
            {
                this.transform.position += this.settings.baseOffset+new Vector3(
                        Random.Range(this.settings.randomOffsetFrom.x, this.settings.randomOffsetTo.x),
                        Random.Range(this.settings.randomOffsetFrom.y, this.settings.randomOffsetTo.y),
                        Random.Range(this.settings.randomOffsetFrom.z, this.settings.randomOffsetTo.z));
            }

            if(this.settings.animate)
            {
                if(this.settings.xRandom) this.xSpeed = Random.Range(this.settings.xMin, this.settings.xMax);
                else this.xSpeed = this.settings.xSpeed;
                if(this.settings.yRandom) this.ySpeed = Random.Range(this.settings.yMin, this.settings.yMax);
                else this.ySpeed = this.settings.ySpeed;
                if(this.settings.zRandom) this.zSpeed = Random.Range(this.settings.zMin, this.settings.zMax);
                else this.zSpeed = this.settings.zSpeed;
            }

            if(this.settings.flash)
            {
                EventFader comp = (EventFader)this.combatant.GetComponent("EventFader");
                if(comp == null)
                {
                    comp = (EventFader)this.combatant.AddComponent("EventFader");
                }
                if(this.settings.fromCurrent)
                {
                    comp.StartCoroutine(comp.FlashCurrent(this.settings.flashChildren, this.settings.flashAlpha, this.settings.alphaEnd,
                            this.settings.flashRed, this.settings.redEnd, this.settings.flashGreen, this.settings.greenEnd,
                            this.settings.flashBlue, this.settings.blueEnd, this.settings.flashInterpolate, this.settings.flashTime,
                            false, "_Color", false));
                }
                else
                {
                    comp.StartCoroutine(comp.Flash(this.settings.flashChildren, this.settings.flashAlpha, this.settings.alphaStart, this.settings.alphaEnd,
                            this.settings.flashRed, this.settings.redStart, this.settings.redEnd, this.settings.flashGreen,
                            this.settings.greenStart, this.settings.greenEnd, this.settings.flashBlue, this.settings.blueStart,
                            this.settings.blueEnd, this.settings.flashInterpolate, this.settings.flashTime,
                            false, "_Color", false));
                }
            }
            init = true;
        }
        else
        {
            GameObject.Destroy(this.gameObject);
        }
        return init;
    }