linking system updates components

beta.r3js.org
-=yb4f310 2017-12-11 13:39:34 +01:00
parent f48920d08c
commit 7f2f35e114
3 changed files with 48 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
// COMPILE TIME DEFINITIONS (Generated via gulp)
var __DATE__ = "Mon Dec 11 2017 12:41:18 GMT+0100 (CET)";
var __DATE__ = "Mon Dec 11 2017 13:39:17 GMT+0100 (CET)";
// END COMPILE TIME DEFINITIONS
/**
@ -30622,6 +30622,7 @@ GameLib.System.Linking = function(
* Components
*/
this.componentCreatedSubscription = null;
this.componentUpdateSubcription = null;
this.componentClonedSubscription = null;
this.registerDependenciesSubscription = null;
this.componentRemoveSubscription = null;
@ -30658,6 +30659,7 @@ GameLib.System.Linking = function(
* Arrays
*/
this.arrayItemAddedSubscription = null;
};
GameLib.System.Linking.prototype = Object.create(GameLib.System.prototype);
@ -30675,6 +30677,11 @@ GameLib.System.Linking.prototype.start = function() {
this.componentCreated.bind(this)
);
this.componentUpdateSubcription = this.subscribe(
GameLib.Event.COMPONENT_UPDATE,
this.componentUpdate.bind(this)
);
this.componentClonedSubscription = this.subscribe(
GameLib.Event.COMPONENT_CLONED,
this.componentCloned.bind(this)
@ -31064,6 +31071,20 @@ GameLib.System.Linking.prototype.componentCreated = function(data) {
};
/**
* Trigger a component update
* @param data
*/
GameLib.System.Linking.prototype.componentUpdate = function(data){
var component = GameLib.EntityManager.Instance.findComponentByName(data.name);
component[data.property][data.subProperty] = data.value;
component.updateInstance(data.property);
};
GameLib.System.Linking.prototype.componentCloned = function(data) {
this.componentCreated(data);
@ -31507,6 +31528,7 @@ GameLib.System.Linking.prototype.stop = function() {
* Components
*/
this.componentCreatedSubscription.remove();
this.componentUpdateSubcription.remove();
this.componentClonedSubscription.remove();
this.registerDependenciesSubscription.remove();
this.componentRemoveSubscription.remove();

View File

@ -27,6 +27,7 @@ GameLib.System.Linking = function(
* Components
*/
this.componentCreatedSubscription = null;
this.componentUpdateSubcription = null;
this.componentClonedSubscription = null;
this.registerDependenciesSubscription = null;
this.componentRemoveSubscription = null;
@ -63,6 +64,7 @@ GameLib.System.Linking = function(
* Arrays
*/
this.arrayItemAddedSubscription = null;
};
GameLib.System.Linking.prototype = Object.create(GameLib.System.prototype);
@ -80,6 +82,11 @@ GameLib.System.Linking.prototype.start = function() {
this.componentCreated.bind(this)
);
this.componentUpdateSubcription = this.subscribe(
GameLib.Event.COMPONENT_UPDATE,
this.componentUpdate.bind(this)
);
this.componentClonedSubscription = this.subscribe(
GameLib.Event.COMPONENT_CLONED,
this.componentCloned.bind(this)
@ -469,6 +476,20 @@ GameLib.System.Linking.prototype.componentCreated = function(data) {
};
/**
* Trigger a component update
* @param data
*/
GameLib.System.Linking.prototype.componentUpdate = function(data){
var component = GameLib.EntityManager.Instance.findComponentByName(data.name);
component[data.property][data.subProperty] = data.value;
component.updateInstance(data.property);
};
GameLib.System.Linking.prototype.componentCloned = function(data) {
this.componentCreated(data);
@ -912,6 +933,7 @@ GameLib.System.Linking.prototype.stop = function() {
* Components
*/
this.componentCreatedSubscription.remove();
this.componentUpdateSubcription.remove();
this.componentClonedSubscription.remove();
this.registerDependenciesSubscription.remove();
this.componentRemoveSubscription.remove();