void GameEnd1(int win0) // second Game End, before web. { Player.win = win0; int isWin = ((Player.win == 1)?1:0); GlobalInfo.playCnt++; GlobalInfo.winCnt += isWin; AimLine.HideAimLines(); //net Net.instance.SendMsg(new Game.GameEnd(this)); }
void Update() { if (!started || Player.win != 0 || GameManager.noPhysics) { return; } UpdateTopUI(); Transform sideCue = Player.IsPlayer()?sideCueLeft:sideCueRight; Transform sideOppositeCue = Player.IsPlayer()?sideCueRight:sideCueLeft; sideCue.gameObject.SetActive(false); sideOppositeCue.gameObject.SetActive(true); //sideOppositeCue.GetComponent<CanvasGroup>().alpha=1.0f; if (send_rate++ % 15 == 0 && Player.player_type == PLAYER_TYPE.MASTER) { SerializeCue(); } ballController.transform.position = CurrentFrame.Balls[0].r = cuePivot.position = BallControllers[0].transform.position; if (GetPlayingStatus()) { ShowFrame(); //cueRotation.position=new Vector3(cueRotation.position.x,1000.0f,cueRotation.position.z); cueRotation.localScale = new Vector3(0.0f, 0.0f, 0.0f); return; } if (Player.player_type == PLAYER_TYPE.SLAVE) { SyncedMovement(); } else if (Player.player_type == PLAYER_TYPE.AI) { AIUPdate(); } //AI Action rotationDisplacement = (new Vector2(cueBallPivot.PositionX, cueBallPivot.PositionY)); if (whiteballmoving) { AimLine.HideAimLines(); } else { drawAimLine(); } cueRotation.position = new Vector3(cueRotation.position.x, 10.0f, cueRotation.position.z); Vector3 vec_MouseDown = Camera.main.ScreenToWorldPoint(Input.mousePosition); //user Event if (Input.GetMouseButtonDown(0) && Player.IsPlayer()) { cueDisplacement = 0.0f; #if UNITY_ANDROID || UNITY_IOS if (Mathf.Abs(vec_MouseDown.x) > 16.0f) { sideControlled = true; } else { sideControlled = false; } #endif if (Mathf.Abs(vec_MouseDown.z) < 8.2f) { hand.SetActive(false); cueStrPos = GetWorldPointConvertedPosition(); Debug.Log("cueStrPos : " + cueStrPos); #if UNITY_ANDROID || UNITY_IOS canControlled = true; #else sideControlled = true; #endif } } if (Input.GetMouseButtonUp(0)) { if (cueDisplacement != 0.0f && sideControlled && canUpdate && !whiteballmoving) { Debug.Log(cueDisplacement + " : cueDisplacement"); isShoting = true; } //cueRotation.localPosition = checkCuePosition - cueDisplacement*Vector3.forward; #if MOBILE canControlled = false; #else else { sideControlled = false; } #endif whiteballmoving = false; #if UNITY_ANDROID || UNITY_IOS if (GameManager.isMobileScene) { CurNodeBack.transform.position = new Vector3(CurNodeBackPosition0.x, CurNodeBackPosition0.y, CurNodeBackPosition0.z); ControlCue.transform.position = new Vector3(ControlCuePosition0.x, ControlCuePosition0.y, ControlCuePosition0.z); } #endif }