Ejemplo n.º 1
0
    public void ApplyTimeDelta(float delta)
    {
        if (_elementsInProgress.Count == 0)
        {
            return;
        }

        var inProgress = _elementsInProgress.Peek();

        inProgress.ApplyDelta(delta);

        if (OnTimeProductionChange != null)
        {
            OnTimeProductionChange.Invoke(inProgress);
        }

        if (inProgress.NormalizedProductionTime >= 1)
        {
            _elementsInProgress.Dequeue();
            if (OnProductionChange != null)
            {
                OnProductionChange.Invoke();
            }
            if (OnDone != null)
            {
                OnDone.Invoke(inProgress.Element);
            }
        }
    }
Ejemplo n.º 2
0
 public void RemoveFromProduction(InProduction inProgress)
 {
     _elementsInProgress = new Queue <InProduction>(_elementsInProgress.Where((x) => x != inProgress));
     if (OnProductionChange != null)
     {
         OnProductionChange.Invoke();
     }
 }
Ejemplo n.º 3
0
    public void AddInProduction(ProductionElement element)
    {
        if (!_possibleProduction.Contains(element))
        {
            throw new System.InvalidOperationException();
        }

        _elementsInProgress.Enqueue(new InProduction(element, 0));

        if (OnProductionChange != null)
        {
            OnProductionChange.Invoke();
        }
    }