private void Update() { if (_TaskSource_M != null) { S_Task ST = _TaskSource_M.GetTask(); if (ST != null) { if (ST.TimeEnding()) { _Ligth_red.enabled = true; _Ligth_Blue.enabled = false; return; } _Ligth_Blue.enabled = true; _Ligth_red.enabled = false; return; } _Ligth_Blue.enabled = false; _Ligth_red.enabled = false; } _Ligth_Blue.enabled = false; _Ligth_red.enabled = false; }
IEnumerator IE_TASK() { _IS_IE_TASK = true; yield return(new WaitForSeconds(Random.Range(1, 5))); _Task = S_Task.GetRandomTask(); if (_ControllContainer != null) { _ControllContainer.StartWork(); } yield return(new WaitForSeconds(1)); while (_Task.CouldSubTask() > 0 && !_Task.IsFailed() && !_Room.IS_FINISH()) { _Task.TimerAdd(-0.5f); if (_Task.GetTimer() <= 0) { _Task.Failed(); } yield return(new WaitForSeconds(0.5f)); } yield return(new WaitForSeconds(0.5f)); if (_ControllContainer != null) { _ControllContainer.PreEndWork(); } if (!_Room.IS_FINISH()) { _Room.ScoreEvent().Event_Task_Finish(_Task.IsFailed(), _Task.GetReward()); } _Task = null; yield return(new WaitForSeconds(2f)); if (_ControllContainer != null) { _ControllContainer.EndWork(); } yield return(new WaitForSeconds(Random.Range(1, 10))); _IS_IE_TASK = false; }
private void Update() { if (_TaskSource_M != null) { S_Task ST = _TaskSource_M.GetTask(); if (ST != null) { if (ST.TimeEnding()) { SET_CONT_ACT(true); _Sprite_Timer.fillAmount = ST.TimerEndingStatus(); } else { SET_CONT_ACT(false); } _Anim.SetBool(ANIM_ID_Failed, ST.IsFailed()); int CouldSub = ST.CouldSubTask(); _Anim.SetInteger(ANIM_ID_COULD, CouldSub); if (CouldSub > 0) { _Task_E1.SetTask(ST.GetSubTask(0)); } if (CouldSub > 1) { _Task_E2.SetTask(ST.GetSubTask(1)); } if (CouldSub > 2) { _Task_E3.SetTask(ST.GetSubTask(2)); } return; } _Anim.SetInteger(ANIM_ID_COULD, 0); SET_CONT_ACT(false); return; } _Anim.SetInteger(ANIM_ID_COULD, 0); SET_CONT_ACT(false); }
static public S_Task GetRandomTask() { S_Task Tas = new S_Task(); S_I_Diff DIFF_ = S_A_GameRoom.GetInstance().GetDiff(); float MUL_DIF = DIFF_.GetDiffMul(); float MUL_DIF_M = 2 - MUL_DIF; int Could_Task = ConvertDiff(Random.Range(0, 100), 100, MUL_DIF, 3); int Max_Chest_Task = ConvertDiff(Random.Range(0, 100), 100, MUL_DIF * 1.1f, 4); List <GameObject> Temp = new List <GameObject>(); Temp.AddRange(S_A_GameRoom.GetInstance().GetAllTemplate()); for (int T_ = 0; T_ < Could_Task; T_++) { S_Task_Element ST = new S_Task_Element(); GameObject TT = Temp[Random.Range(0, Temp.Count)]; Temp.Remove(TT); ST._Could = Random.Range(1, Max_Chest_Task); ST._Chest = TT.GetComponent <S_A_Chest>(); Tas.Reward += (int)(ST._Could * 10f * MUL_DIF); Tas.Reward = (int)(Tas.Reward * 1.1f); Tas.Timer += ST._Could * 25f * MUL_DIF_M; Tas._ListTask.Add(ST); } return(Tas); }