refactor: followed handles room changes
This commit is contained in:
parent
867262e81d
commit
00359fb6f9
|
@ -41,11 +41,6 @@ const room = new Room();
|
|||
room.world = new World();
|
||||
const roomView = new RoomView(room, stage.renderer);
|
||||
stage.addChild(roomView);
|
||||
room.on('sizeChanged', () => {
|
||||
if (hasSelfEntity() && selfEntity.is('followed')) {
|
||||
selfEntity.camera.areaSize = room.size;
|
||||
}
|
||||
});
|
||||
// Time.
|
||||
const worldTime = new WorldTime();
|
||||
let lastWorldTime = worldTime.humanReadable();
|
||||
|
@ -65,7 +60,6 @@ room.on('entityAdded', (entity) => {
|
|||
// Camera tracking.
|
||||
entity.addTrait('followed');
|
||||
const {camera} = entity;
|
||||
camera.areaSize = room.size;
|
||||
camera.on('realPositionChanged', () => {
|
||||
roomView.position = Vector.round(
|
||||
Vector.sub(halfVisibleSize, camera.realPosition)
|
||||
|
|
Loading…
Reference in New Issue
Block a user