public override List <bool> check_for_destroy(List <Ball> balls, int my_pos) { List <bool> res = get_false_list(balls); //Debug.logger.Log("info", "adding ball my_pos " + my_pos.ToString()); //Debug.logger.Log("info", "balls.Count is " + balls.Count.ToString()); if (my_pos == 0 || my_pos == balls.Count - 1) { return(res); } bool ok = false; RainbowBall rainbow_ball_down = balls[my_pos - 1] as RainbowBall; RainbowBall rainbow_ball_up = balls[my_pos + 1] as RainbowBall; ok |= rainbow_ball_down != null || rainbow_ball_up != null; ColoredBall colored_ball_down = balls[my_pos - 1] as ColoredBall; ColoredBall colored_ball_up = balls[my_pos + 1] as ColoredBall; if (colored_ball_down != null && colored_ball_up != null) { ok |= colored_ball_up.ball_color == colored_ball_down.ball_color; } if (ok) { res[my_pos - 1] = true; res[my_pos] = true; res[my_pos + 1] = true; } return(res); }
public int GetIdOfBall(ColoredBall ball) { for (int i = 0; i < objectiveBalls.Length; i++) { if (objectiveBalls[i] == ball) { return(i); } } return(-1); }
// Update is called once per frame void Update() { if (!m_wait_for_next_move.did_time_passed()) { return; } var values = System.Enum.GetValues(typeof(ColoredBall.BallColors)); GetComponent <Renderer>().material.color = ColoredBall.get_color(inner_colors[color_index]); color_index++; color_index %= inner_colors.Count; }
private void PrepareBalls() { //int numColors = (int)ColoredBall.BallColor.Count; totalBalls = ballCount; objectiveBalls = new ColoredBall[totalBalls]; int i = 0; //for (int i = 0; i < numColors; i++) //{ for (int j = 0; j < ballCount; j++) { ColoredBall gb = Instantiate(golfBallPrefab, transform); gb.Initialize(this); gb.gameObject.SetActive(false); gb.BecomeColor((ColoredBall.BallColor)i, coloredBallMats[i]); objectiveBalls[(i * ballCount) + j] = gb; } //} // Send Message EventController.FireEvent(new ObjectBallsSpawnedMessage(objectiveBalls)); }
public override void update_player() { m_player.GetComponent <Renderer>().material.color = ColoredBall.get_color(m_color); }