// Start is called before the first frame update
    public void Start()
    {
        front  = GameObject.Find("front");
        script = front.GetComponent <LostPoint>();
        int final = script.score;

        finaler.text = "総Score:" + final.ToString();

        this.timerText = GameObject.Find("Time");
        ContinueButton.SetActive(false);
        //FinalScore.SetActive(false);
    }
        public (bool validateResult, Exception exception) Validate(LostPoint cmd, string team1Id, string team2Id, GameStatus status)
        {
            var exceptions = new List <Exception>();

            if (status == GameStatus.End)
            {
                exceptions.Add(new LostPointException("Game status can't be end.", status));
            }

            if (new[] { team1Id, team2Id }.Any(o => o == cmd.TeamId) == false)
            {
                exceptions.Add(new LostPointException("The specific team Id is not exist.", cmd.TeamId));
            }

            return(exceptions.Count == 0, new AggregateException(exceptions));
        }
        public void LosePoint(LostPoint cmd)
        {
            var(team1Id, team2Id) = GetAllTeamId();
            if (new LosePointPolicy().Validate(cmd, team1Id, team2Id, Status) is (bool validateResult, Exception exception) &&
                validateResult == false)
            {
                throw exception;
            }

            var team = GetTeam(cmd.TeamId, cmd.PlayerId);

            team.Deduction();

            var(score, status) = new ScoreService().Judge(this);
            RaiseEvent(new LosePointEvent(cmd.TeamId, cmd.PlayerId, score, status));

            Score  = score;
            Status = status;
        }