void start() { thePlayer = GameObject.Find("GumballCreation"); playerScript = thePlayer.GetComponent <GumballCreationScripts> (); print("script"); print(playerScript); gumballCreationScript = gameObject.GetComponent <GumballCreationScripts>(); }
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); }