public void startOnlineServer() { Dev.log(Tag.Network, "You Clicked to initiate Server1"); GameRunningScript.getInstance().myPlayerChar = Character.Thief; Network.InitializeServer(2, portNum, true); Dev.log(Tag.Network, "You Clicked to initiate Server3"); }
public void DoubleClick(Vector2 vect) { if (GameRunningScript.getInstance().isClickActive == false) { return; } }
public void SingleClick(Vector2 vect) { if (GameRunningScript.getInstance().isClickActive == false) { return; } Ray ray = cam.ScreenPointToRay(vect); RaycastHit point; if (Physics.Raycast(ray, out point, 20000, layerMask)) { if (point.collider.gameObject.GetComponent <PlayerControlScript>() != null) { PlayerControlScript player = point.collider.gameObject.GetComponent <PlayerControlScript>(); player.setSelected(true); } else if (point.collider.gameObject.GetComponent <CheckPoints>() != null) { CheckPoints check = point.collider.gameObject.GetComponent <CheckPoints>(); if (!check.getClickable()) { return; } if (GameRunningScript.getInstance().selectedPlayer == null) { return; } //TODO Do a method to decide the transport method GameRunningScript.getInstance().myPlayer.sendMove(check, TransportType.Cycle); GameRunningScript.getInstance().selectedPlayer.moveMyPlayer(check, TransportType.Cycle); Dev.log(Tag.GameClickListener, "Hit : " + check.name); } } }
public void getPolices() { for (int i = 0; i < 5; i++) { myPolices[i].initPolicePlayer(GameRunningScript.getInstance().gameClickHandler.selectRandomPolice(i + 1), policeController, i); } getThief(); }
public override void OnReceivedBroadcast(string fromAddress, string data) { if (netScript == null) { netScript = GameRunningScript.getInstance().myNetworkScript; } netScript.addPlayer(fromAddress, data); }
// Use this for initialization void Start() { cam = Camera.main; GameRunningScript.getInstance().gameClickHandler = this; if (GameRunningScript.getInstance().myPlayerChar == Character.Thief) { myPlayerScript.getPolices(); } //myPlayerScript.initiateChecks(allChecks); }
public void sendMove(CheckPoints check, TransportType type) { if (GameRunningScript.getInstance().myPlayerChar == Character.Police) { netView.RPC("policeSendMove", RPCMode.OthersBuffered, new object[] { GameRunningScript.getInstance().selectedPlayer.getIndex() , check.getIndex(), (int)type }); } else { netView.RPC("thiefSendMoves", RPCMode.OthersBuffered, new object[] { (int)type }); } }
private void showCountDown() { if (GameRunningScript.getInstance().countDown > 0) { timerWindow.SetActive(true); timerText.text = "" + GameRunningScript.getInstance().countDown; } else { timerWindow.SetActive(false); } }
public void setSelected(bool b) { if (isDisabled) { return; } if (b) { if (GameRunningScript.getInstance().selectedPlayer != this) { if (GameRunningScript.getInstance().selectedPlayer != null) { GameRunningScript.getInstance().selectedPlayer.setSelected(false); } } else { return; } GameRunningScript.getInstance().selectedPlayer = this; meshRenderer.material = selectedMat; if (isClickable) { //TODO Do operation to highlight currentCheck.setSelected(true); } else { if (isMoving) { //TODO Show the timeleft for cool down controller.showTravellingWindow(); } else { //TODO Show the timeleft for cool down with the highlighting controller.showCooldownWindow(); } } } else { //TODO Do operation to De highlight currentCheck.setSelected(false); //TOOD Remove all cooldown and time left Window controller.hideAllWindows(); meshRenderer.material = unselectedMat; GameRunningScript.getInstance().selectedPlayer = null; } }
public void searchOnline() { Dev.log(Tag.Network, "You Clicked to Search Server 1"); GameRunningScript.getInstance().myPlayerChar = Character.Police; if (input.text == null || input.text == "" || input.text.Length == 0) { Network.Connect("127.0.0.1", portNum); } else { Network.Connect(input.text, portNum); } Dev.log(Tag.Network, "You Clicked to Search Server 2"); }
void Awake() { netView = GetComponent <NetworkView>(); isLocalPlayer = netView.isMine; isServer = GameRunningScript.getInstance().isServer; if (GameRunningScript.getInstance().myPlayerChar == Character.Police) { policeController.gameObject.SetActive(true); } else { thiefController.gameObject.SetActive(true); } }
private void initMyPlayer(CheckPoints ch, Character c, int ind) { isDisabled = false; character = c; index = ind; currentCheck = ch; if (character != GameRunningScript.getInstance().myPlayerChar) { isDisabled = true; } Dev.log(Tag.PlayerControllerScript, "Initiatin the player at " + currentCheck.transform.position + " : " + currentCheck.getIndex()); transform.position = currentCheck.transform.position; meshRenderer.material = unselectedMat; isClickable = true; setSelected(false); }
private IEnumerator moveToPlace(CheckPoints orig, CheckPoints next, TransportType type) { isMoving = true; isClickable = false; Vector3 finalPos = next.transform.position; float speed = getSpeed(type); while (true) { //TODO Move at a given rate(tranport) Vector3 cur = GameMethods.getProjectionWithSpeed(finalPos, transform.position, speed, Time.deltaTime); transform.position = cur; if (cur == finalPos) { break; } yield return(new WaitForEndOfFrame()); } isMoving = false; if (GameRunningScript.getInstance().selectedPlayer == this) { controller.showCooldownWindow(); } currentTime = coolDownTime; while (currentTime > 0) { if (GameRunningScript.getInstance().selectedPlayer == this) { controller.setCooldownTime(currentTime); } yield return(new WaitForSeconds(1)); currentTime--; } currentCheck = next; isClickable = true; if (GameRunningScript.getInstance().selectedPlayer == this) { setSelected(false); setSelected(true); } yield break; }
void Start() { GameRunningScript.getInstance().policePos = myPolices; GameRunningScript.getInstance().myPlayer = this; myChar = GameRunningScript.getInstance().myPlayerChar; }
//{close}Temp Section Delete After Testing is done. // Use this for initialization void Start() { GameRunningScript.getInstance().myNetworkScript = this; netView = GetComponent <NetworkView>(); }
/// <summary> /// Called on the server whenever a Network.InitializeServer was invoked and has completed. /// </summary> void OnServerInitialized() { Dev.log(Tag.Network, "Now you are the server."); GameRunningScript.getInstance().isServer = true; input.text = Network.player.ipAddress; }
private void getThief() { myThief.initThiefPlayer(GameRunningScript.getInstance().gameClickHandler.selectThiefLoc(myPolices), thiefController, -1); GameRunningScript.getInstance().thiefPos = myThief; formInitialMessage(); }