public void PlaySkeet() { if (skeets.used.Count > 0) { GameObject skeet = skeets.used[0]; float x = Random.Range(-5, 5); skeet.transform.GetComponent <Rigidbody>().isKinematic = false; skeet.GetComponent <Rigidbody>().velocity = new Vector3(x, 8 * (Mathf.CeilToInt(FirstSceneController.times / 10) + 1) + 2, 6); skeet.GetComponent <Rigidbody>().AddForce(new Vector3(0, 8.8f, 0), ForceMode.Force); PhysicAction physicAction = PhysicAction.GetSSAction(); seq.Add(physicAction); this.RunAction(skeet, physicAction, this); skeets.used.RemoveAt(0); } if (Input.GetMouseButtonDown(0) && sceneController.flag == 0) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hitGameObject; if (Physics.Raycast(ray, out hitGameObject)) { GameObject gameObject = hitGameObject.collider.gameObject; if (gameObject.tag == "skeet") { gameObject.transform.position = new Vector3(100, 100, 100); userClickAction = UserClickAction.GetSSAction(); this.RunAction(gameObject, userClickAction, this); } } } base.Update(); }
public static PhysicAction GetSSAction() { PhysicAction action = CreateInstance <PhysicAction>(); return(action); }