/// <summary> /// スコアを通知する /// </summary> /// <param name="score">スコアデータ</param> public void NotifyObservers(Pong.PlayerScore score) { foreach (var observer in observers) { observer.Update(score); } ExecuteRequestRemove(); }
/// <summary> /// 勝ったプレイヤーの取得 /// </summary> /// <param name="score">スコア</param> /// <returns>勝ったプレイヤー</returns> public Pong.PlayerConstant.Position GetWinner(Pong.PlayerScore score) { UnityEngine.Assertions.Assert.IsTrue(CheckEnd(score)); if (score.Get(Pong.PlayerConstant.Position.Left) > score.Get(Pong.PlayerConstant.Position.Right)) { return(PlayerConstant.Position.Left); } return(PlayerConstant.Position.Right); }
/// <summary> /// ゲームが終了したかチェック /// </summary> /// <param name="score">スコア</param> /// <returns>trueなら終了</returns> public bool CheckEnd(Pong.PlayerScore score) { if (score.Get(Pong.PlayerConstant.Position.Left) >= EndScore) { return(true); } if (score.Get(Pong.PlayerConstant.Position.Right) >= EndScore) { return(true); } return(false); }