private void UpdateTriggers()
    {
        int index = 0;

        for (int i = 0; i < _triggerEvents.Count; i++)
        {
            _temp = _triggerEvents[index];
            if (GetProcessRatio() >= _temp.Ratio)
            {
                _curTriggerEvents.Clear();

                if (_temp.IsEnd != null && _temp.NeedPauseProcess)
                {
                    _curTriggerEvents.Add(_temp);
                }

                if (_temp.Action != null)
                {
                    _temp.Action();
                }

                index++;
            }
            else
            {
                break;
            }
        }

        _triggerEvents.RemoveRange(0, index);
    }
Exemple #2
0
    public static GameProcessTriggerEvent GetTriggerEvent(float ratio, Action action, bool needPauseProcess, Func <bool> isEnd)
    {
        GameProcessTriggerEvent e = new GameProcessTriggerEvent();

        e.AddEvent(ratio, action, needPauseProcess, isEnd);
        return(e);
    }
    public List <GameProcessTriggerEvent> GetTriggerEvents()
    {
        var list = new List <GameProcessTriggerEvent>();
        GameProcessTriggerEvent e = new GameProcessTriggerEvent();

        e.AddEvent(1, Start, false, JudgeEnd);
        list.Add(e);
        return(list);
    }