Exemplo n.º 1
0
    public void update(GameTime gameTime)
    {
        if (_registerInfosInit.Count > 0)
        {
            for (int i = 0; i < _registerInfosInit.Count;)
            {
                RegisterInfo info = _registerInfosInit[i];
                info.startTime = gameTime.TotalGameTime.TotalSeconds + info.delay;

                _registerInfosInit.RemoveAt(i);
                _registerInfos.Add(info);
            }
        }

        if (_registerInfos.Count > 0)
        {
            for (int i = 0; i < _registerInfos.Count;)
            {
                RegisterInfo info = _registerInfos[i];
                if (gameTime.TotalGameTime.TotalSeconds >= info.startTime)
                {
                    _register(info, gameTime);

                    _registerInfos.RemoveAt(i);
                    continue;
                }

                ++i;
            }
        }

        if (_keys.Count > 0)
        {
            for (int i = 0; i < _keys.Count;)
            {
                object obj = _keys[i];

                TransSet trans = _registry[obj];
                if (!trans.update(gameTime))
                {
                    _keys.RemoveAt(i);

                    if (_registry.ContainsKey(obj))
                    {
                        _registry.Remove(obj);
                    }

                    continue;
                }

                if (_registry.ContainsKey(obj))
                {
                }

                ++i;
            }
        }

        //_components.update(game, gameTime);
    }
Exemplo n.º 2
0
    void _register(RegisterInfo info, GameTime gameTime)
    {
        object obj = info.obj;


        TransSet trans;

        if (!_registry.ContainsKey(obj))
        {
            trans = new TransSet()
            {
                obj = obj
            };
            _registry[obj] = trans;

            if (!_keys.Contains(obj))
            {
                _keys.Add(obj);
            }
        }

        trans = _registry[obj];
        trans.updateProperties(gameTime, info.properties, info.time, info.transition);

        if (info.callback != null)
        {
            trans.callbacks.Add(info.callback);
        }
    }