private void OnCollisionEnter(Collision collision) { if (isHuman) { if (!PhotonNetwork.IsConnected || photonView.IsMine) { ((ToolHuman)tool).TriggerHapticFeedback(0.1f, 100, 30); } } if (collision.collider.gameObject.layer == LayerMask.NameToLayer("Ball")) { if (velocity.magnitude > velocityLowerThreshold) { if (PhotonNetwork.IsConnected) { PhotonNetwork.Instantiate(sparkPrefab.name, collision.GetContact(0).point, Quaternion.identity); } else { Instantiate(sparkPrefab, collision.GetContact(0).point, Quaternion.identity); } } if (!PhotonNetwork.IsConnected || photonView.IsMine) { PlaytestRecording.RecordHit(); } } }
void OnTriggerEnter(Collider col) { if (!isActiveAndEnabled || // case 1: 2 players, handle on thrower's side (receiver's goal is disabled) !PhotonNetwork.IsConnected || // case 2: not connected, both goals are on PhotonNetwork.CurrentRoom.PlayerCount < 2) // case 3: only one player, both goals are on { if (col.gameObject.layer == LayerMask.NameToLayer("Ball")) { // Prevent own goal if (col.gameObject.GetComponent <Ball>().GetPlayerNumber() != playerNumber) { ScoreManager.Instance.AddScoreToOpponent(playerNumber, 1); BallManager.LocalInstance.PutBallInPool(col.GetComponent <Ball>()); if (PhotonNetwork.IsConnected) { photonView.RPC("Goal_SetHitMaterial", RpcTarget.AllBuffered); PhotonNetwork.Instantiate(sparkPrefab.name, col.transform.position, Quaternion.identity); } else { StartCoroutine(ShowGoalHitFor(0.5f)); Instantiate(sparkPrefab, col.transform.position, Quaternion.identity); } PlaytestRecording.RecordGoalScored(); } } } }
public void ThrowCurrentBall() { anim.SetTrigger("throw"); currentBall.OnDetachFromHand(); currentBall = null; PlaytestRecording.RecordThrow(); // Have a slight delay so that the ball does not immediately hit the tool StartCoroutine(DelayAndSwitchToTool(spawnDelay)); }
private void OnCollisionEnter(Collision collision) { Collider col = collision.collider; if (col.gameObject.layer == LayerMask.NameToLayer("Ball")) { Debug.Log(col.gameObject.GetComponent <Ball>().GetPlayerNumber()); // Prevent own goal if (col.gameObject.GetComponent <Ball>().GetPlayerNumber() != playerNumber) { BallManager.LocalInstance.PutBallInQueue(col.GetComponent <Ball>()); PlaytestRecording.RecordMiss(); } } }
public void SwitchGoals() { GoalType goalType = GoalType.REGULAR; PhotonHashtable hash = PhotonNetwork.CurrentRoom.CustomProperties; object temp; if (hash.TryGetValue("RoomGoalType", out temp)) { if (temp is byte) { goalType = (GoalType)System.Enum.ToObject(typeof(GoalType), temp); Debug.Log("goalType for this game: " + goalType); } else { Debug.Log("RoomGoalType: unexpected custom property value type"); } } else { Debug.Log("RoomGoalType: custom property not found"); } switch (goalType) { case GoalType.REGULAR: regularGoal.SetActive(true); hWallGoal.SetActive(false); vWallGoal.SetActive(false); break; case GoalType.HORIZONTAL_WALL: regularGoal.SetActive(false); hWallGoal.SetActive(true); vWallGoal.SetActive(false); break; case GoalType.VERITCAL_WALL: regularGoal.SetActive(false); hWallGoal.SetActive(false); vWallGoal.SetActive(true); break; } GoalInitEvent.Invoke(); PlaytestRecording.RecordGoalType(goalType); }
private void Start() { if (PhotonNetwork.IsConnected) { PhotonHashtable hash = PhotonNetwork.CurrentRoom.CustomProperties; object temp; if (hash.TryGetValue("RoomRoundDuration", out temp)) { gameDuration = (int)temp * 60; Debug.Log("duration for this game: " + gameDuration + " seconds"); } else { Debug.Log("RoomRoundDuration: custom property not found"); } } timeLeft = gameDuration; PlaytestRecording.RecordRoundDuration((int)gameDuration / 60); }
private void StopRecordingDistMoved() { isRecording = false; Debug.Log("dist moved so far: " + totalDistMoved); PlaytestRecording.RecordDistHeadMoved(totalDistMoved); }
IEnumerator WriteLogAfterFrame() { yield return(new WaitForEndOfFrame()); PlaytestRecording.WriteLog(); }
private void OnCaloriesCalculated(int caloriesBurnt) { PlaytestRecording.RecordCaloriesBurnt(caloriesBurnt); PlaytestRecording.WriteLog(); caloriesBurntText.text = caloriesBurnt.ToString(); }