// Use this for initialization void Start() { this.timeBeforeNextSpawn = this.delaySpawn; gameMode = ((GameObject)GameObject.FindGameObjectWithTag("gamemode")).GetComponent<SorterGamemode>(); sorterColors = gameMode.GetComponent<SorterColors>(); }
public void setColor(SorterColors.BallColor color, Material m) { if (this.GetComponent<Renderer>().material == null) Debug.Log("SorterBall : something is wrong here"); this.color = color; this.GetComponent<Renderer>().material = m; }
// Use this for initialization void Start() { gameMode = ((GameObject)GameObject.FindGameObjectWithTag("gamemode")).GetComponent<SorterGamemode>(); sorterColors = gameMode.GetComponent<SorterColors>(); this.GetComponent<Renderer>().material = sorterColors.getMaterial(color); coin = GameObject.Find("Coin").GetComponent<AudioSource>(); }
public void spawnBall(SorterColors.BallColor color) { GameObject ball = (GameObject)Instantiate(sorterBall, this.transform.position, Quaternion.identity); ball.GetComponent<SorterBall>().setColor(color, sorterColors.getMaterial(color)); }