using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreSubjectStep
{
///
/// 步骤id
///
public int subProcessId;
///
/// 步骤满分
///
public float maxScore;
///
/// 步骤得分
///
public float currentScore=0;
///
/// 步骤是否已完成
///
public bool isDone;
///
/// 是否一票否决
///
public bool isOneVoteVeto;
///
/// 步骤
///
public D_SubProcess step;
public ScoreSubjectStep(int subProcessId,float maxScore,bool isOneVoteVeto=false)
{
this.subProcessId = subProcessId;
this.maxScore = maxScore;
this.isOneVoteVeto= isOneVoteVeto;
}
public ScoreSubjectStep(float maxScore)
{
this.maxScore = maxScore;
}
///
/// 得全或扣光
///
///
/// 是否可以重复打分
public void SetScore(bool AllScore,bool canRepeat=false)
{
if (!isDone || canRepeat)
{
isDone = true;
currentScore = (AllScore ? maxScore : 0);
currentScore = (float)Math.Round(currentScore, 2);
Debug.LogError(string.Format("打分:{0}.{1} 得分:{2} / {3}", subProcessId, step.subProcessName, currentScore, maxScore));
}
}
///
/// 百分比分数
///
///
public void SetScore(float scaleScore, bool canRepeat=false)
{
if (!isDone || canRepeat)
{
isDone = true;
currentScore = scaleScore*maxScore;
currentScore = (float)Math.Round(currentScore,2);
Debug.LogError(string.Format("打分:{0}.{1} 得分:{2} / {3}", subProcessId, step.subProcessName, currentScore, maxScore));
}
}
}