public WaitingForStrikeState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; PlayerPrefs.SetFloat("factor", 0.0f); gameController.gameState = StatesOfGame.WAITING_FOR_STRIKE_STATE; cue = gameController.cue; cueBall = gameController.cueBall; PoolGameController.GameInstance.gameState = StatesOfGame.WAITING_FOR_STRIKE_STATE; line = cueBall.GetComponent <LineRenderer> (); line2 = gameController.GetComponent <LineRenderer> (); text = GameObject.FindGameObjectWithTag("Timer").GetComponent <Text> (); mainCamera = gameController.mainCamera; cue.GetComponent <Renderer> ().enabled = true; image = gameController.image; if (MoveImageScript.Instance != null) { MoveImageScript.Instance.handler += OnDragEvent; } else { } imagePanel = gameController.imagePanel; imagePanel.SetActive(true); cue.transform.position = cueBall.transform.position + gameController.strikeDirection * (-1) * PoolGameController.MIN_DISTANCE; cue.transform.position = new Vector3(cue.transform.position.x, 9f, cue.transform.position.z); cue.transform.RotateAround(cueBall.transform.position, Vector3.down, 0); //cue.transform.RotateAround (cueBall.transform.position, Vector3.up, 0); }
public StrikingState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cueBall = gameController.cueBall; gameController.gameState = StatesOfGame.STRIKING_STATE; line = cueBall.GetComponent <LineRenderer> (); line.startWidth = 0; line.endWidth = 0; line.enabled = false; line2 = gameController.GetComponent <LineRenderer> (); line2.startWidth = 0; line2.endWidth = 0; line2.enabled = false; PoolGameController.GameInstance.gameState = StatesOfGame.STRIKING_STATE; factor = PlayerPrefs.GetFloat("factor", factor); K = 0.1f; }