// Use this for initialization void Start () { AIOn = true; controlOn = true; player = this.gameObject; playerRigid = this.GetComponent<Rigidbody>(); playerRigid.velocity = new Vector3(0, 0, 0); playerH = player.transform.lossyScale.y; terrain = GameObject.Find("terrain"); ground = GameObject.Find("Ground"); cam = GameObject.Find("Main Camera"); camScript = cam.GetComponent<CueLevels>(); omega = camScript.omega*Mathf.Deg2Rad; Physics.gravity = new Vector3(0, -gravity, 0); rayDir = new Vector3[rayCastNum]; for (int i = 0; i < rayCastNum; i++) { rayDir[i] = new Vector3(Mathf.Cos(Mathf.PI / (rayCastNum-1) * i+Mathf.PI), Mathf.Sin(Mathf.PI / (rayCastNum - 1) * i + Mathf.PI), 0); } rayLen = playerH * (0.5f + rayRadius); raydarDir = new Vector3[raydarNum]; for (int i = 0; i < raydarNum; i++) { raydarDir[i] = new Vector3(Mathf.Cos(2 * Mathf.PI / (raydarNum-1) * i/2-Mathf.PI/2), Mathf.Sin(2 * Mathf.PI / (raydarNum-1) * i/2-Mathf.PI/2), 0); } preAir = air; }
// Use this for initialization void Start () { cueLevelScript = this; camTrans = this.GetComponent<Transform>(); terrain = GameObject.Find("terrain"); terrainTrans = terrain.transform; player = GameObject.Find("Player"); playerTrans = player.transform; relPos = new Vector3(camTrans.position.x - playerTrans.position.x, camTrans.position.y - playerTrans.position.y, 0); initialCamPos = camTrans.position; menu = GameObject.Find("MainMenu"); heavenRoad = GameObject.Find("HeavenRoadButton"); dialog = GameObject.Find("Dialog"); menu2 = GameObject.Find("Menu2"); score = GameObject.Find("Score"); BGM = this.GetComponent<AudioSource>(); BGMVolume = BGM.volume; terrainText = GameObject.Find("terrainText"); AlienLeft = GameObject.Find("AlienLeft"); AlienRight = GameObject.Find("AlienRight"); AlienLeft.SetActive(false); AlienRight.SetActive(false); dialog.SetActive(false); menu2.SetActive(false); score.SetActive(false); // if(unlocked==0) heavenRoad.GetComponent<Button>().interactable = false; cam = GameObject.Find("Main Camera").GetComponent<Camera>(); //playerScript = player.GetComponent<Player>(); DrawLine.lineColor = color; Player.color = color; levelIndex = 1; }