public void changePlayer(int n) { ballOptions.currentPlayer = false; camNumber = n; playerControl = GameObject.FindGameObjectsWithTag("player")[camNumber].GetComponent <PlayerControl>(); ballOptions = GameObject.FindGameObjectsWithTag("player")[camNumber].GetComponent <BallOptions>(); sendHealthIndicator(); ballOptions.currentPlayer = true; changeDirection(ballOptions.sky, ballOptions.tempSky); }
public static GameObject CreateBall(BallOptions options) { var go = GameObject.CreatePrimitive(PrimitiveType.Sphere); go.transform.position = options.Pos; go.transform.SetParent(options.Parent, false); go.transform.localScale = Vector3.one * (options.Size ?? 0.03f); if (options.Color.HasValue) { go.GetComponent <Renderer>().material.color = options.Color.Value.ColorWithAlpha(0); } return(go); }
void Start() { lookAt = GameObject.FindGameObjectsWithTag("player")[camNumber].GetComponent <Transform>(); healthIndicator = GameObject.FindGameObjectWithTag("HealthIndicator").GetComponent <Text>(); camTransform = transform; camNumber = 0; dir = new Vector3(0, 5, -4); playerControl = FindObjectOfType <PlayerControl>(); ballOptions = GameObject.FindGameObjectsWithTag("player")[camNumber].GetComponent <BallOptions>(); ballOptions.currentPlayer = true; timeCountWhenGravityChanges = 0.0f; sky = new Vector3(0.0f, 9.0f, 0.0f); sendSetPressDown(); }