Ejemplo n.º 1
0
    void Start()
    {
        lifecycleManager = GetComponent <ObstacleLifecycle>();
        pulse            = GetComponent <Pulsing>();
        spriteRenderer   = GetComponent <SpriteRenderer>();

        trueEffectDuration = effectDuration + Random.value * effectDurationVar;
    }
Ejemplo n.º 2
0
    void Start()
    {
        transform.localScale = new Vector3(0, 0, 1);
        phase        = LifeCyclePhase.APPEARING;
        creationTime = Time.time;

        // Set up pulsing
        pulse = GetComponent <Pulsing>();
        if (pulse != null)
        {
            pulse.enabled = false;
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// coroutine to slide panels together then display full billboard (strobes the neon border)
    /// </summary>
    /// <returns></returns>
    private IEnumerator BillOpenMain(Billboard billboard)
    {
        /*lightIndex = 0;
         * lightCounter = 0;*/

        screenCounter       = 0;
        billTextTop.text    = ProcessBillboardTextTop(billboard);
        billTextBottom.text = billboard.textBottom.ToUpper();
        billTextName.text   = GameManager.i.playerScript.FirstName.ToUpper();
        if (billboard.sprite != null)
        {
            billLogo.sprite = billboard.sprite;
            billLogo.gameObject.SetActive(true);
        }
        else
        {
            billLogo.gameObject.SetActive(false);
        }
        //any longer than set num of char's will cause issues with pulsing, use a default text instead
        if (billTextName.text.Length > maxNameChars)
        {
            billTextName.text = "Yes YOU!";
        }
        //determine parameters for name text font size pulsing (max size is current max size feasible in space)
        fontSizeMax     = billTextName.fontSize;
        fontSizeCurrent = fontSizeMax;
        fontSizeState   = Pulsing.Fading;

        fontSizeCounter = 0.0f;
        isBeamLeftOn    = true;
        isBeamRightOn   = true;
        //modal state
        GameManager.i.inputScript.SetModalState(new ModalStateData()
        {
            mainState = ModalSubState.Billboard
        });
        //slide blinds
        while (screenCounter < screenDistance)
        {
            screenCounter += screenSpeed * Time.deltaTime;
            billLeft.transform.localPosition  = new Vector3(-screenDistance + screenCounter, 0, 0);
            billRight.transform.localPosition = new Vector3(screenDistance - screenCounter, 0, 0);
            yield return(null);
        }
        SetBillboardCentre(true);
        //indefinitely strobe outer panel (cyan neon borders)
        isFading = true;
        while (true)
        {
            outerColour = billPanelOuter.color;
            if (isFading == false)
            {
                outerColour.a += Time.deltaTime / flashBorder;
                if (outerColour.a >= 1.0f)
                {
                    isFading = true;
                }
            }
            else
            {
                outerColour.a -= Time.deltaTime / flashBorder;
                if (outerColour.a <= 0.0f)
                {
                    isFading = false;
                }
            }
            billPanelOuter.color = outerColour;
            //Name text font size Pulsing
            switch (fontSizeState)
            {
            case Pulsing.Constant:
                //pause pulsing at max font size for a short moment
                fontSizeCounter += Time.deltaTime;
                if (fontSizeCounter > fontSizeCounterMax)
                {
                    fontSizeState   = Pulsing.Fading;
                    fontSizeCounter = 0.0f;
                }
                break;

            case Pulsing.Growing:
                //grow at a faster rate than shrinking
                fontSizeCurrent += fontSizeCurrent * Time.deltaTime * fontSizeSpeed * fontSizeBoost;
                if (fontSizeCurrent >= fontSizeMax)
                {
                    fontSizeState = Pulsing.Constant;
                    //make sure fontsize doesn't momentarily go over the max and be outside the displayable area
                    fontSizeCurrent = Mathf.Min(fontSizeCurrent, fontSizeMax);
                }
                break;

            case Pulsing.Fading:
                //shrinking
                fontSizeCurrent -= fontSizeCurrent * Time.deltaTime * fontSizeSpeed;
                if (fontSizeCurrent <= fontSizeMin)
                {
                    fontSizeCurrent = Mathf.Max(0.0f, fontSizeCurrent);
                    fontSizeState   = Pulsing.Growing;
                }
                break;

            default: Debug.LogWarningFormat("Unrecognised fontSizeState \"{0}\"", fontSizeState); break;
            }
            //adjust font size
            billTextName.fontSize = fontSizeCurrent;
            //light beams at top randomly flash on/off
            if (isBeamLeftOn == true)
            {
                if (Random.Range(0, 100) < beamChance)
                {
                    //switch off
                    billBeamLeft.gameObject.SetActive(false);
                    isBeamLeftOn    = false;
                    beamLeftCounter = 0.0f;
                }
            }
            else
            {
                //momentary off (flicker)
                beamLeftCounter += Time.deltaTime;
                if (beamLeftCounter > beamCounterMax)
                {
                    //switch on
                    billBeamLeft.gameObject.SetActive(true);
                    isBeamLeftOn = true;
                }
            }
            if (isBeamRightOn == true)
            {
                if (Random.Range(0, 100) < beamChance)
                {
                    //switch off
                    billBeamRight.gameObject.SetActive(false);
                    isBeamRightOn    = false;
                    beamRightCounter = 0.0f;
                }
            }
            else
            {
                beamRightCounter += Time.deltaTime;
                if (beamRightCounter > beamCounterMax)
                {
                    //switch on
                    billBeamRight.gameObject.SetActive(true);
                    isBeamRightOn = true;
                }
            }
            yield return(null);
        }
    }
Ejemplo n.º 4
0
 void Awake()
 {
     instance = this;
 }