コード例 #1
0
    void SpawnBall()
    {
        objectsArray.AddLast(new RouteSegment(Instantiate(ballPrefabe, startNode.transform.position, new Quaternion(0, 0, 0, 1)), 1, forwardSpeed));
        S_Ball objComponent = objectsArray.Last.Value.obj.GetComponent <S_Ball>();

        objComponent.isInArray = true;
        objComponent.SetColor(rngObj.Next());
    }
コード例 #2
0
    void SpawnBall()
    {
        ball = Instantiate(ballPrefabe, transform.position, new Quaternion(0, 0, 0, 1));
        ball.SetColor((int)currentColor);

        Renderer materialRenderer = transform.GetChild(0).GetComponent <Renderer>();

        materialRenderer.material = materials[(int)currentColor];

        nextColor = (BallColor)rngObject.Next();

        materialRenderer          = transform.GetChild(1).GetComponent <Renderer>();
        materialRenderer.material = materials[(int)nextColor];

        rb           = ball.GetComponent <Rigidbody>();
        currentColor = nextColor;
    }