// private int X1 = 24, X2 = -24, Z1 = 30, Z2 = -30; public StrikingState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cueBall = gameController.cueBall; }
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; }
public cuePosition(MonoBehaviour parent) : base(parent) { game = (PoolGameController)parent; cue = game.cue; cueBall = game.cueBall; mainCamera = game.mainCamera; cue.GetComponent <Renderer>().enabled = true; }
private PoolGameController gameController; // assign the pool controller to game controller variable // Inheritance the pool game controller public WaitingForStrikeState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cue_ball = gameController.cueBall; main_camera = gameController.mainCamera; cue.GetComponent <Renderer>().enabled = true; }
public WaitingForStrikeState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cueBall = gameController.cueBall; mainCamera = gameController.mainCamera; cue.GetComponent<Renderer>().enabled = true; }
void Awake() { GameInstance = this; pausedGame = null; // Input.simulateMouseWithTouches = true; if (cue == null) { } CurrentPlayer = new Player("John", "Player1CollectedBalls"); }
void Start() { strikeDirection = Vector3.forward; // sets the player name, if time let user set it Player_one = new Player("P1"); Player_two = new Player("P2"); GameInstance = this; winnerMessage.GetComponent <Canvas>().enabled = false; currentState = new GameStates.WaitingForStrikeState(this); }
public StrikeState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cueBall = gameController.cueBall; var forceAmplitude = gameController.maxForce - gameController.minForce; var relativeDistance = (Vector3.Distance(cue.transform.position, cueBall.transform.position) - PoolGameController.MIN_DISTANCE) / (PoolGameController.MAX_DISTANCE - PoolGameController.MIN_DISTANCE); force = forceAmplitude * relativeDistance + gameController.minForce; }
public cueForce(MonoBehaviour parent) : base(parent) { game = (PoolGameController)parent; cue = game.cue; cueBall = game.cueBall; var force = game.maxForce - game.minForce; var distance = (Vector3.Distance(cue.transform.position, cueBall.transform.position) - PoolGameController.MIN_DISTANCE) / (PoolGameController.MAX_DISTANCE - PoolGameController.MIN_DISTANCE); game.force = force * distance + game.minForce; }
void Start() { strikeDirection = Vector3.forward; CurrentPlayer = new Player("John"); OtherPlayer = new Player("Doe"); GameInstance = this; winnerMessage.GetComponent <Canvas>().enabled = false; currentState = new GameStates.WaitingForStrikeState(this); }
public nextTurn(MonoBehaviour parent) : base(parent) { game = (PoolGameController)parent; cue = game.cue; cueBall = game.cueBall; mainCamera = game.mainCamera; cameraOffset = cueBall.transform.position - mainCamera.transform.position; cameraRotation = mainCamera.transform.rotation; cueOffset = cueBall.transform.position - cue.transform.position; cueRotation = cue.transform.rotation; }
void Start() { if (PoolGameController.GameInstance != null) { gameController = PoolGameController.GameInstance; cueBall = gameController.cueBall; } else { cueBall = null; } }
void Start() { // Physics.gravity = new Vector3(-112, 98, -16); strikeDirection = Vector3.left; CurrentPlayer = new Player("Anan1"); OtherPlayer = new Player("Anan2"); GameInstance = this; winnerMessage.GetComponent <Canvas>().enabled = false; currentState = new GameStates.WaitingForStrikeState(this); }
void Start() { originalCueBallPosition = cueBall.transform.position; if (PoolGameController.GameInstance != null) { gameController = PoolGameController.GameInstance; } collectionBox = GameObject.FindGameObjectWithTag("CollectionBox"); if (collectionBox == null) { Debug.LogError("Not found"); } }
public WaitingForNextTurnState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cue = gameController.cue; cueBall = gameController.cueBall; redBalls = gameController.redBalls; mainCamera = gameController.mainCamera; cameraOffset = cueBall.transform.position - mainCamera.transform.position; cameraRotation = mainCamera.transform.rotation; cueOffset = cueBall.transform.position - cue.transform.position; cueRotation = cue.transform.rotation; }
void Awake() { GameInstance = this; pausedGame = null; // Input.simulateMouseWithTouches = true; if (cue == null) { } CurrentPlayer = new Player("John", "Player1CollectedBalls"); line3 = gameObject.GetComponent <LineRenderer> (); if (line3 == null) { Debug.LogError("Line rendered error "); } }
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; PoolGameController.GameInstance.gameState = StatesOfGame.STRIKING_STATE; factor = PlayerPrefs.GetFloat("factor", factor); K = 0.1f; }
public StrikeState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; gameController.gameState = StatesOfGame.STRIKE_STATE; cue = gameController.cue; cueBall = gameController.cueBall; factor = gameController.factor; var forceAmplitude = gameController.maxForce - gameController.minForce; var relativeDistance = (Vector3.Distance(cue.transform.position, cueBall.transform.position) - PoolGameController.MIN_DISTANCE) / (PoolGameController.MAX_DISTANCE - PoolGameController.MIN_DISTANCE); force = forceAmplitude * factor + gameController.minForce; imagePanel = gameController.imagePanel; imagePanel.SetActive(false); PoolGameController.GameInstance.gameState = StatesOfGame.STRIKE_STATE; line = cueBall.GetComponent <LineRenderer> (); line.startWidth = 0; line.endWidth = 0; }
public WaitingForNextTurnState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; gameController.gameState = StatesOfGame.WAITING_FOR_NEXT_PLAYER_STATE; cue = gameController.cue; cueBall = gameController.cueBall; redBalls = gameController.redBalls; mainCamera = gameController.mainCamera; PoolGameController.GameInstance.gameState = StatesOfGame.WAITING_FOR_NEXT_PLAYER_STATE; cue.transform.position = cueBall.transform.position + gameController.strikeDirection * (-1) * PoolGameController.MIN_DISTANCE; cue.transform.position = new Vector3(cue.transform.position.x, 4.55f, cue.transform.position.z); cue.transform.RotateAround(cueBall.transform.position, Vector3.down, 0); cameraOffset = cueBall.transform.position - mainCamera.transform.position; cameraRotation = mainCamera.transform.rotation; cueOffset = cueBall.transform.position - cue.transform.position; cueRotation = cue.transform.rotation; Debug.Log("waiting for next Player "); }
public PlaceCueBallState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; cueBall = gameController.cueBall; cue = gameController.cue; }
void Start() { cueBallDirection = Vector3.forward; GameInstance = this; currentState = new Game.cuePosition(this); }
void Start() { strikeDirection = Vector3.forward; CurrentPlayer = new Player("John"); OtherPlayer = new Player("Doe"); GameInstance = this; winnerMessage.GetComponent<Canvas>().enabled = false; currentState = new GameStates.WaitingForStrikeState(this); }
public FinishState(MonoBehaviour parent) : base(parent) { gameController = (PoolGameController)parent; time = gameController.t; gameController.gameState = StatesOfGame.FINISH_STATE; }
//private float speed = 50; public cueSpeed(MonoBehaviour parent) : base(parent) { game = (PoolGameController)parent; cue = game.cue; cueBall = game.cueBall; }