Beispiel #1
0
    @Override
    public void setConfig(ActorSpriteConfig config) {
      super.setConfig(config);

      // find the corresponding entry sprite and its model
      EntryState estate = (EntryState) ((ActorSprite) _parentScope).getActor();
      EntrySprite esprite = _view.getEntrySprite(estate.getKey());
      _entryModel = (esprite == null) ? null : esprite.getModel();
    }
Beispiel #2
0
    @Override
    public void update(Actor actor) {
      super.update(actor);

      // update the state animation
      EntryState estate = (EntryState) actor;
      int entered = estate.getStateEntered();
      if (entered > _lastStateEntered) {
        int state = estate.getState();
        Animation anim = (_states != null && state < _states.length) ? _states[state] : null;
        if (anim != null) {
          anim.start();
          anim.tick((_view.getDelayedTime() - entered) / 1000f);
        }
        _lastStateEntered = entered;
      }
    }
Beispiel #3
0
    @Override
    public void update(Actor actor) {
      super.update(actor);

      ActorSpriteConfig.StatefulModelEntry config = (ActorSpriteConfig.StatefulModelEntry) _config;

      // update the state animation
      EntryState estate = (EntryState) actor;
      int entered = estate.getStateEntered();
      if (entered > _lastStateEntered) {
        int state = estate.getState();
        ConfigReference<ModelConfig> model =
            (state < config.states.length) ? config.states[state].model : null;
        if (model != null && _entryModel != null) {
          _entryModel.setConfig(model);
        }
        _lastStateEntered = entered;
      }
    }
Beispiel #4
0
    @Override
    public void setConfig(ActorSpriteConfig config) {
      super.setConfig(config);

      // find the corresponding entry sprite and its model
      EntryState estate = (EntryState) ((ActorSprite) _parentScope).getActor();
      EntrySprite esprite = _view.getEntrySprite(estate.getKey());
      _entryModel = (esprite == null) ? null : esprite.getModel();
      if (_entryModel == null) {
        return;
      }

      // resolve the state animations
      ActorSpriteConfig.StatefulEntry sconfig = (ActorSpriteConfig.StatefulEntry) config;
      _states = new Animation[sconfig.states.length];
      for (int ii = 0; ii < _states.length; ii++) {
        _states[ii] = _entryModel.createAnimation(sconfig.states[ii].animation);
      }
    }