// ############################################################### // Unity Functions // ############################################################### void Start() { // find the position of the middle wave's y position lastWaveY = GameObject.Find("Middle Waves").transform.position.y; // set boat speed speed = Difficulty.boatSpeed; Vector3 rightBorder = new Vector3(Screen.width, 0.0f, 0.0f); screenWidth = (Camera.main.ScreenToWorldPoint(rightBorder)).x; // set up the path point to move the boat around currentPoint = path.getPathEnumerator(); currentPoint.MoveNext(); if (currentPoint.Current == null) { return; } transform.position = currentPoint.Current.position; }
// ############################################################### // Functions // ############################################################### // Initialization (called once when gameObject is created). void Start() { currentPoint = path.getPathEnumerator(); currentPoint.MoveNext(); transform.position = currentPoint.Current.position; }