Example #1
0
    void Start()
    {
        spriteRenderer = gameObject.GetComponent <SpriteRenderer>();

        Line       = GameObject.Find("LineHolder");
        lineScript = Line.GetComponent <LineScript>();

        squares      = GameObject.Find("Squares");
        squareScript = squares.GetComponent <Game>();

        circle     = Resources.Load <Sprite>("Sprites/Circle2");
        deadCircle = Resources.Load <Sprite>("Sprites/Deadcircle");

        setColor = lineScript.setColor;

        if (loadColors)
        {
            colorNum = Manager.circleList[num];

            lineScript.AddToCircleList(num, colorNum);

            spriteRenderer.color = setColor[colorNum];

            Color color = spriteRenderer.color;
            color.a = 0.5f;
            spriteRenderer.color = color;
        }

        else
        {
            NewColor();
        }

        SetSprite();
    }
Example #2
0
    void NewColor()
    {
        colorNum = Random.Range(0, setColor.Length - 1);

        float rolledDie = Random.Range(0.00f, 1.00f);

        if (rolledDie <= lineScript.deadOdds)
        {
            colorNum = setColor.Length - 1;
        }

        lineScript.AddToCircleList(num, colorNum);

        spriteRenderer.color = setColor[colorNum];

        Color color = spriteRenderer.color;

        color.a = 0.5f;
        spriteRenderer.color = color;

        SetSprite();
    }