コード例 #1
0
    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);
    }
コード例 #2
0
 public VComponent CloneComponent(VComponent component)
 {
     return(DeepClone <VComponent>(component));
 }
コード例 #3
0
 public void AddComponent(VEntity entity, VComponent component)
 {
     entity.Components.Add(component);
 }
コード例 #4
0
 public void QueueAnimationEvent(string prefix, IList <VComponent> components = null, VComponent component = null)
 {
     animationQueue.Add(CreateEvent(prefix, components, component));
 }
コード例 #5
0
        // 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);
        }
コード例 #6
0
        // 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);
        }
コード例 #7
0
        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);
        }