Ejemplo n.º 1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (!isMoving && !isOut)
        {
            auxTimeCycle -= Time.fixedDeltaTime;

            if (!rocas.IsBlock && PowerController.Instance.IsBlocked)
            {
                auxTimeCycle += PowerController.Instance.TimeBloked;
                rocas.Block();
            }

            if (auxTimeCycle <= 0)
            {
                Salir();
            }
        }
        else if (isMoving && !isOut)
        {
            auxMove += speed;
            Salir(auxMove);
            if (auxMove >= 1)
            {
                isOut    = true;
                isMoving = false;
            }
        }
        else if (!isMoving && isOut)
        {
            if (!isWaiting)
            {
                auxMove = 0;

                StartCoroutine(WaitCocodrileisOut(timeWait));
            }
        }
        else if (isMoving && isOut)
        {
            auxMove += speed / 2;
            Volver(auxMove);
            if (auxMove >= 1)
            {
                Reposar();
            }
        }
    }