Exemple #1
0
    void Update()
    {
        if (alpha[0] != alpha[1])
        {
            int alphaSlot = 2;
            if (alpha[1] == 0f)
            {
                alphaSlot = 3;
            }

            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[alphaSlot] * SCR_main.counterMult));

            DisplayAlpha();

            if (alpha[1] == 0f && alpha[0] == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }

        if (lifeSpan > 0f)
        {
            if (alpha[1] > 0f)
            {
                lifeSpan = Mathf.MoveTowards(lifeSpan, 0f, Time.deltaTime);

                if (lifeSpan == 0f)
                {
                    Kill();
                }
            }
        }
    }
Exemple #2
0
    void UpdateAlpha()
    {
        alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (changeSpeed[1] * SCR_main.counterMult));

        DisplayColour();

        if (alpha[0] == 0f && alpha[1] == 0f)
        {
            SCR_main.DestroyObj(gameObject);
        }
    }
Exemple #3
0
    void Update()
    {
        if (lifeCounter > 0f)
        {
            lifeCounter = Mathf.MoveTowards(lifeCounter, 0f, Time.deltaTime);

            if (lifeCounter == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Exemple #4
0
    void Update()
    {
        if (isActive == false)
        {
            if (destroyCounter != 0f)
            {
                destroyCounter = Mathf.MoveTowards(destroyCounter, 0f, Time.deltaTime);

                if (destroyCounter == 0f)
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Exemple #5
0
    void Update()
    {
        if (fading)
        {
            if (fadeCounter != 0f)
            {
                fadeCounter = Mathf.MoveTowards(fadeCounter, 0f, (Time.deltaTime * 3f));

                trail.endWidth = (trailWidth + ((1f + (fadeCounter * -1f)) * trailWidth * 5f));
                DisplayColour();

                if (fadeCounter == 0f)
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Exemple #6
0
    void Update()
    {
        if (flashTotal > 0)
        {
            UpdateFlash();
        }
        if (spinSpeed != 0f)
        {
            transform.Rotate(Vector3.up * spinSpeed * Time.deltaTime);
        }

        if (fadeCounter > 0f)
        {
            fadeCounter = Mathf.MoveTowards(fadeCounter, 0f, Time.deltaTime);

            if (fadeCounter == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Exemple #7
0
    void UpdateAlpha()
    {
        if (alpha[1] == 1f)
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[2] * Time.deltaTime));
        }
        else
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[3] * Time.deltaTime));
        }

        DisplayColour();

        if (fadeAway)
        {
            if (alpha[0] == 0f && alpha[1] == 0f)
            {
                SCR_main.DestroyObj(gameObject);
            }
        }
    }
Exemple #8
0
    void Update()
    {
        UpdateScale();

        if (alpha[0] != alpha[1])
        {
            alpha[0] = Mathf.MoveTowards(alpha[0], alpha[1], (alpha[2] * SCR_main.counterMult));

            DisplayAlpha();

            if (alpha[0] == alpha[1])
            {
                if (alpha[1] == 1f)
                {
                    fadeFinished = true;
                }
                else
                {
                    SCR_main.DestroyObj(gameObject);
                }
            }
        }
    }
Exemple #9
0
    void UpdateAction()
    {
        character.SetRotAngle(currentTargetEnemy.transform.position);

        actionCounter += Time.deltaTime;

        if (action == 0 || action == 1)
        {
            if (action == 0)
            {
                character.speed[1] = (character.dir * character.runSpeed);

                if (actionCounter >= actionLimit)
                {
                    SetAction(1);
                }
            }
            else
            {
                if (actionCounter >= actionLimit)
                {
                    SetAction(0);
                }
            }
            character.SetRotTarget();

            CheckPlayerDistance(1);
        }
        else
        {
            if (action == 2)
            {
                //ready to attack
                character.SetRotTarget();

                if (actionCounter >= actionLimit)
                {
                    SetAction(3);
                }

                CheckPlayerDistance(2);
            }
            else
            {
                if (action == 10)
                {
                    //dying

                    if (actionCounter >= 1.25f)
                    {
                        if (SCR_main.pOn)
                        {
                            SCR_text p = SCR_gui.CreateText("PopUpPoints", Vector3.zero);
                            p.UpdateText(points.ToString());
                            p.SetWorldPos(transform.position, 1f);
                            p.SetFadeSpeed(0.55f, 0.2f);
                        }

                        SetAction(11);
                        character.StartFlash(1, 1000);
                        GetComponent <BoxCollider>().isTrigger = true;
                    }
                }
                else
                {
                    if (action == 11)
                    {
                        //vanishing
                        if (actionCounter >= 0.55f)
                        {
                            SCR_main.DestroyObj(gameObject);
                        }
                    }
                }
            }
        }
    }