private void HitTile(GameTile gt) { gt.RpcChangeColor(new Color(0f, 0f, 0f, 0.1f), gt.note.length); gt.DisableTouch(); _score += gt.note.rewardValue; if (!_gameUIManager) { _gameUIManager = GetComponent <GameUIManager>(); } _gameUIManager.SetScore(id, _score); }
private void CmdHandleTouch(Vector3 origin, Vector3 direction, int touchPhase) { int score = 0; if (touchPhase == 0) { Ray ray = new Ray(origin, direction); RaycastHit hit; if (Physics.Raycast(ray, out hit, 150f, _layerMask)) { int hitLayerValue = ((1 << hit.collider.gameObject.layer) & _layerMask); if (hitLayerValue == TILE_LAYER) { GameTile gt = hit.collider.gameObject.GetComponent <GameTile>(); if (!gt.touched) { gt.RpcChangeColor(_hitColor, gt.note.length); gt.DisableTouch(); score = gt.note.rewardValue; playerScore += score; string sound = gt.note.soundName; if (!_soundManager) { _soundManager = GetComponent <SoundManager>(); } _soundManager.RpcPlaySound(sound); } } else if (hitLayerValue == UI_LAYER) { return; } else if (hitLayerValue == TILE_RUNWAY_LAYER) { CmdMissTile(hit.point, networkIdentity.isServer); RpcReducePlayerScore(); } } } if (!_gameUIManager) { _gameUIManager = GetComponent <GameUIManager>(); } if (!player) { player = GetComponent <Player>(); } _gameUIManager.SetScore(player.id, playerScore + score); }