public VComponent Clone() { var fields = this.fields .Select(field => new KeyValuePair <string, object>(field.Key, field.Value)) .ToArray(); VComponent clone = new VComponent(type, fields); return(clone); }
public VComponent CloneComponent(VComponent component) { return(DeepClone <VComponent>(component)); }
public void AddComponent(VEntity entity, VComponent component) { entity.Components.Add(component); }
public void QueueAnimationEvent(string prefix, IList <VComponent> components = null, VComponent component = null) { animationQueue.Add(CreateEvent(prefix, components, component)); }
// helper function for creating an entity that will be put on the event stack. public VEntity ExecuteImmediateEvent(string prefix, IList <VComponent> components = null, VComponent component = null) { VEntity ent = CreateEntity(prefix, components: components, component: component); gameplayEventQueue.ImmediateExecute(ent); return(ent); }
// helper function for creating an entity that will be put on the event stack. public VEntity CreateEvent(string prefix, IList <VComponent> components = null, VComponent component = null) { VEntity ent = CreateEntity(prefix, components: components, component: component); StackEvent(ent); return(ent); }
public VEntity CreateEntity(string prefix, IList <VComponent> components = null, VComponent component = null) { if (component != null) { components = new List <VComponent> { component }; } VEntity v = new VEntity { id = prefix + "_" + Guid.NewGuid().ToString(), Components = components == null ? new List <VComponent>() : new List <VComponent>(components) }; gameEntities.Add(v); return(v); }