mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-04 15:27:30 +07:00
Refactored ds1 references from ObjectComponent and MonsterComponent to MapComponent
This commit is contained in:
@ -13,6 +13,7 @@ import com.riiablo.engine.component.AnimationComponent;
|
||||
import com.riiablo.engine.component.ClassnameComponent;
|
||||
import com.riiablo.engine.component.CofComponent;
|
||||
import com.riiablo.engine.component.IdComponent;
|
||||
import com.riiablo.engine.component.MapComponent;
|
||||
import com.riiablo.engine.component.MonsterComponent;
|
||||
import com.riiablo.engine.component.ObjectComponent;
|
||||
import com.riiablo.engine.component.PositionComponent;
|
||||
@ -116,12 +117,14 @@ public class Engine extends PooledEngine {
|
||||
PositionComponent positionComponent = createComponent(PositionComponent.class);
|
||||
|
||||
ObjectComponent objectComponent = createComponent(ObjectComponent.class);
|
||||
objectComponent.map = map;
|
||||
objectComponent.zone = zone;
|
||||
objectComponent.ds1 = ds1;
|
||||
objectComponent.object = object;
|
||||
objectComponent.base = base;
|
||||
|
||||
MapComponent mapComponent = createComponent(MapComponent.class);
|
||||
mapComponent.map = map;
|
||||
mapComponent.zone = zone;
|
||||
mapComponent.ds1 = ds1;
|
||||
mapComponent.object = object;
|
||||
|
||||
Entity entity = createEntity();
|
||||
entity.add(typeComponent);
|
||||
entity.add(cofComponent);
|
||||
@ -143,13 +146,15 @@ public class Engine extends PooledEngine {
|
||||
MonStats2.Entry monstats2 = Riiablo.files.monstats2.get(monstats.MonStatsEx);
|
||||
|
||||
MonsterComponent monsterComponent = createComponent(MonsterComponent.class);
|
||||
monsterComponent.map = map;
|
||||
monsterComponent.zone = zone;
|
||||
monsterComponent.ds1 = ds1;
|
||||
monsterComponent.object = object;
|
||||
monsterComponent.monstats = monstats;
|
||||
monsterComponent.monstats2 = monstats2;
|
||||
|
||||
MapComponent mapComponent = createComponent(MapComponent.class);
|
||||
mapComponent.map = map;
|
||||
mapComponent.zone = zone;
|
||||
mapComponent.ds1 = ds1;
|
||||
mapComponent.object = object;
|
||||
|
||||
TypeComponent typeComponent = createComponent(TypeComponent.class);
|
||||
typeComponent.type = TypeComponent.Type.MON;
|
||||
|
||||
|
21
core/src/com/riiablo/engine/component/MapComponent.java
Normal file
21
core/src/com/riiablo/engine/component/MapComponent.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.riiablo.engine.component;
|
||||
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
import com.riiablo.map.DS1;
|
||||
import com.riiablo.map.Map;
|
||||
|
||||
public class MapComponent implements Component, Pool.Poolable {
|
||||
public Map map;
|
||||
public Map.Zone zone;
|
||||
public DS1 ds1;
|
||||
public DS1.Object object;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
map = null;
|
||||
zone = null;
|
||||
ds1 = null;
|
||||
object = null;
|
||||
}
|
||||
}
|
@ -4,23 +4,13 @@ import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
import com.riiablo.codec.excel.MonStats;
|
||||
import com.riiablo.codec.excel.MonStats2;
|
||||
import com.riiablo.map.DS1;
|
||||
import com.riiablo.map.Map;
|
||||
|
||||
public class MonsterComponent implements Component, Pool.Poolable {
|
||||
public Map map;
|
||||
public Map.Zone zone;
|
||||
public DS1 ds1;
|
||||
public DS1.Object object;
|
||||
public MonStats.Entry monstats;
|
||||
public MonStats2.Entry monstats2;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
map = null;
|
||||
zone = null;
|
||||
ds1 = null;
|
||||
object = null;
|
||||
monstats = null;
|
||||
monstats2 = null;
|
||||
}
|
||||
|
@ -3,22 +3,12 @@ package com.riiablo.engine.component;
|
||||
import com.badlogic.ashley.core.Component;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
import com.riiablo.codec.excel.Objects;
|
||||
import com.riiablo.map.DS1;
|
||||
import com.riiablo.map.Map;
|
||||
|
||||
public class ObjectComponent implements Component, Pool.Poolable {
|
||||
public Map map;
|
||||
public Map.Zone zone;
|
||||
public DS1 ds1;
|
||||
public DS1.Object object;
|
||||
public Objects.Entry base;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
map = null;
|
||||
zone = null;
|
||||
ds1 = null;
|
||||
object = null;
|
||||
base = null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user