示例#1
0
 void OnApplyMission(Mission mission, Int16 missionScore)
 {
     if (Global.isGameStart)
     {
         if (mission != Mission.HarvestRate)
         {
             battleHUD.MissionMsg(mission, missionScore);
         }
         _missionScore = missionScore;
         _mission      = mission;
         lastGameTime  = gameTime;               // 任務開始時時間
         _missionMode  = MissionMode.Opening;
     }
 }
示例#2
0
    void OnApplyRate(Mission mission, Int16 scoreRate)
    {
        if (Global.isGameStart)
        {
            if (mission == Mission.HarvestRate)
            {
                Debug.Log("Rate:" + scoreRate);
                if (_score > _otherScore)
                {
                    _scoreRate -= ((float)scoreRate / 100); //scoreRate 在伺服器以整數百分比儲存 這裡是0~1 所以要/100
                }
                else
                {
                    _scoreRate += ((float)scoreRate / 100); //scoreRate 在伺服器以整數0~100 儲存 這裡是0~1 所以要/100
                }

                battleHUD.MissionMsg(mission, _scoreRate);
                _otherRate = 1 - _scoreRate;
                _otherRate = (_otherRate == 0) ? 1 : _otherRate = 1 + _otherRate;                       // 如果 1(原始) - 1(我) = 0 代表倍率相同不調整倍率 ; 如果1 - 0.9(我) = 0.1 代表他多出0.1 ;  如果1 - 1.1(我) = -0.1 代表他少0.1 。最後 1+(+-0.1)就是答案
            }
        }
    }