public void EnableBarrier(bool enabled) { //LogoObject.SetActive(!enabled); if (enabled) { _IsIgnoreInput = false; } else { _isBarrierOpen = true; _IsIgnoreInput = true; HideAllUI(); //GZ_Crowd.Instance.DestroyCrowd(); //GZ_CircleTable.Instance.ClearTable(); StartCoroutine(GZ_Math.PlayAnim_CR(0.5f, (progress) => { EnableScoreBoard(1f - progress); Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress); }, () => { })); } }
public static float GetDegreeBtwVectors(Vector3 aVec, Vector3 bVec, Vector3 upVector) { var dirNum = GZ_Math.GetAngleDir(aVec, bVec, upVector); float angle = Mathf.Acos(Vector2.Dot(aVec.normalized, bVec.normalized)) * Mathf.Rad2Deg; if (dirNum == 1) { angle = 360 - angle; } return(angle); }
void StartGame() { _IsIgnoreInput = true; GZ_Crowd.Instance.CreateCrowd(); StartCoroutine(GZ_Math.PlayAnim_CR(0.5f, (progress) => { Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, progress); }, () => { Scoreboard[0].text = Scoreboard[1].text = "0"; TotalScores[0] = TotalScores[1] = 0; _currentPlayerIndex = -1; _players = new GZ_Player[NumPlayer]; for (int i = 0; i < NumPlayer; i++) { _players[i].Index = i; _players[i].TileScore = _players[i].ComboScore = 0; _players[i].PColor = PlayerColors[i]; } StartCoroutine(GZ_Math.PlayAnim_CR(1f, (percentage) => { EnableScoreBoard(percentage); }, () => { GZ_RadioEmitter.Instance.Bang(); _IsIgnoreInput = false; GZ_CircleTable.Instance.SpawnTable(RowCount, ColCount); TotalTileCount = RowCount * ColCount; OccupiedTileCount = 0; SwitchPlayer(); })); })); }
public void RestartGame() { _IsIgnoreInput = true; _isBarrierOpen = false; GZ_CircleTable.Instance.ClearTable(); StartCoroutine(GZ_Math.PlayAnim_CR(0.5f, (progress) => { EnableScoreBoard(1f - progress); Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress); }, () => { StartGame(); })); }
public bool SelectTile(ref GZ_Player player) { #if UNITY_EDITOR Debug.DrawLine(Vector3.zero, _debugHittedPos, Color.red); #endif RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); bool result = false; if (Physics.Raycast(ray, out hit)) { #if UNITY_EDITOR _debugHittedPos = hit.point; #endif //find proper column var tarVec = hit.point - this.transform.position; var dirNum = GZ_Math.GetAngleDir(this.transform.up, tarVec, this.transform.forward); float angle = Mathf.Acos(Vector2.Dot(tarVec.normalized, this.transform.up)) * Mathf.Rad2Deg; if (dirNum == 1) { angle = 360 - angle; } int matchColumn = (int)(angle / AngleOffset); //find Row for (int r = 0; r < _tileArray.GetLength(0); r++) { result = _tileArray[r, matchColumn].CheckDistance(tarVec.magnitude); if (result) { _tileArray[r, matchColumn].SetInfomation(ref player); return(true); } } } return(result); }
public void EnableRecordSession(bool enabled) { RecordObject.SetActive(enabled); if (enabled) { StartCoroutine(GZ_Math.PlayAnim_CR(0.5f, (progress) => { EnableScoreBoard(1f - progress); Barrier.transform.localScale = Vector3.one * Mathf.Lerp(0.2f, 0, 1 - progress); }, () => { })); } else { StartGame(); } }
void SwitchPlayer() { _IsIgnoreInput = true; GZ_AudioModule.Instance.Play(2); _currentPlayerIndex = ++_currentPlayerIndex % NumPlayer; SwitchPlayerImage[_currentPlayerIndex].SetActive(true); GZ_RadioEmitter.Instance.Bang(); StartCoroutine( GZ_Math.PlayAnim_CR( 0.5f, (percentage) => // scale up { var value = MainUIEnableCurve.Evaluate(percentage); SwitchPlayerImage[_currentPlayerIndex].transform.localScale = Vector3.one * value; }, () => /* done callback */ { //Switch Player StartCoroutine(GZ_Math.WaitFor_CR(1f, () => { StartCoroutine(GZ_Math.PlayAnim_CR(0.5f, //Scale down (percent) => { var value = MainUIEnableCurve.Evaluate(1f - percent); SwitchPlayerImage[_currentPlayerIndex].transform.localScale = Vector3.one * value; }, () => { _IsIgnoreInput = false; SwitchPlayerImage[_currentPlayerIndex].SetActive(false); })); })); })); }