Example #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();
    }
Example #2
0
    @Override
    public void update(Actor actor) {
      super.update(actor);

      // update the base animation
      Animation base = getBase((Mobile) actor);
      if (base != null && !base.isPlaying()) {
        base.start();
      }
    }
Example #3
0
    @Override
    public void setConfig(ActorSpriteConfig config) {
      super.setConfig(config);

      ActorSpriteConfig.Moving mconfig = (ActorSpriteConfig.Moving) config;
      _idles = resolve(mconfig.idles);
      _idleWeights = mconfig.getIdleWeights();
      _movements = resolve(mconfig.movements);
      _rotations = resolve(mconfig.rotations);
    }
Example #4
0
  /** @param args */
  public static void main(String[] args) {
    Original o = new Original("egg");

    Storage s = new Storage(o.createMemento());
    System.out.println("original the value is:" + o.getValue());

    o.setValue("cat");
    System.out.println(o.getValue());

    o.restoreMemento(s.getMemento());
    System.out.println(o.getValue());
  }
Example #5
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;
      }
    }
Example #6
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;
      }
    }
Example #7
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);
      }
    }
Example #8
0
 @Override
 public void getPreloads(ConfigManager cfgmgr, PreloadableSet preloads) {
   super.getPreloads(cfgmgr, preloads);
   preloads.add(new Preloadable.Model(model));
 }