// Update is called once per frame protected new void Update() { if (sceneController.chose) { if (sceneController.count < 10) { if (timer != 0) { timer -= Time.deltaTime; if (timer < 0) { timer = Random.Range(3 - sceneController.level, 6 - sceneController.level); if (sceneController.count < 5) { fly = physics.GetSSAction(); sceneController.number++; this.RunAction(sceneController.disk.GetDisk().Disk, fly, this); } else { int number = Random.Range(1, 3); for (; number > 0; number--) { fly = physics.GetSSAction(); sceneController.number++; this.RunAction(sceneController.disk.GetDisk().Disk, fly, this); } } } } if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.transform.tag == "Disk") { sceneController.score(hit.transform.name); sceneController.disk.destroy(hit.transform.name); } } } base.Update(); } } }
void checkPhysics() { //move the disc around, based on being on the wall or ground if(onWall == true){ gravity = physics.wall; } if(grounded == true){ gravity = physics.ground; } if(gravity == physics.ground){ charTransform.Translate(moveH,0,moveV,Space.World); Physics.gravity = new Vector3( 0, -9.8f, 0); reverseTranslate = new Vector3(-moveH,0,-moveV); } else { charTransform.Translate(moveH,moveV,0,Space.World); Physics.gravity = new Vector3( 0,0,9.8f); reverseTranslate = new Vector3(-moveH,-moveV,0); } }
Vector3 begin;//0,1,-10 public static physics GetSSAction() { physics action = ScriptableObject.CreateInstance <physics>(); return(action); }