예제 #1
0
    void start()
    {
        thePlayer    = GameObject.Find("GumballCreation");
        playerScript = thePlayer.GetComponent <GumballCreationScripts> ();
        print("script");
        print(playerScript);

        gumballCreationScript = gameObject.GetComponent <GumballCreationScripts>();
    }
예제 #2
0
    public float CreateGumballs()
    {
        thePlayer    = GameObject.Find("GumballCreation");
        playerScript = thePlayer.GetComponent <GumballCreationScripts> ();

        print("executed");

        for (int i = 0; i < TOTAL_NUMBER_OF_GUMBALLS_IN_THE_GAME; i++)
        {
            switch (Random.Range(1, 8))
            {
            //1 - for Blue
            case 1:
            case 2:
            case 3:
            case 4:
                GameObject circleObject = (GameObject)gumballFactory.getGumballShape("circle").CreateShape(playerScript);
                createGumball(circleObject);
                break;

            //for circle
            case 5:
            case 6:
                GameObject squareObject = (GameObject)gumballFactory.getGumballShape("square").CreateShape(playerScript);
                createGumball(squareObject);
                break;

            //for square
            case 7:
                createGumball((GameObject)gumballFactory.getGumballShape("star").CreateShape(playerScript));
                break;

            //for star
            default:
                break;
            }
        }

        return(lastBallPos);
    }