Package com.tankz.systems.misc

Source Code of com.tankz.systems.misc.HealthSystem

package com.tankz.systems.misc;

import com.artemis.Aspect;
import com.artemis.ComponentMapper;
import com.artemis.Entity;
import com.artemis.systems.EntityProcessingSystem;
import com.tankz.components.Health;

public class HealthSystem extends EntityProcessingSystem {
  private ComponentMapper<Health> healthMapper;

  public HealthSystem() {
    super(Aspect.getAspectFor(Health.class));
  }

  @Override
  public void initialize() {
    healthMapper = world.getMapper(Health.class);
  }

  @Override
  protected void process(Entity e) {
    Health health = healthMapper.get(e);
   
    if(!health.isAlive()) {
      world.deleteEntity(e);
    }
   
  }


}
TOP

Related Classes of com.tankz.systems.misc.HealthSystem

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.