Example #1
0
    void MousePos()
    {
        prePos = currentPos;

        if (_player.transform.position.y < -screenSize.y + 1.5f)
        {
            currentPos = movePos.bottom;
        }
        else if (_player.transform.position.y > screenSize.y - 1.5f)
        {
            currentPos = movePos.up;
        }
        else
        {
            StartCoroutine(MidState(1.5f));
        }

        if (started)
        {
            if (prePos == movePos.bottom)
            {
                if (currentPos == movePos.up)
                {
                    if (spriteNum < sprites.Length)
                    {
                        ChangeSprite();
                    }
                }
            }
        }
        else
        {
            if (currentPos == movePos.bottom)
            {
                StartCoroutine(Starting(.5f));
            }
        }
    }
Example #2
0
    IEnumerator MidState(float seconds)
    {
        yield return(new WaitForSecondsRealtime(seconds));

        currentPos = movePos.mid;
    }