Esempio n. 1
0
        public virtual ThingInstance Spawn(string instanceId = null)
        {
            ThingInstance instance = System.Activator.CreateInstance(InstanceType) as ThingInstance;

            instance.Breed         = this;
            instance.Id            = instanceId ?? Guid.NewGuid().ToString();
            instance.IsIdGenerated = instanceId == null;
            foreach (var variable in Variables.Values)
            {
                instance.Variables.Add(variable.Name, new Symbol(variable));
            }
            World.Instance.Instances.Add(instance.Id, instance);
            ExecutionVisitor.ExecuteRunBlock(instance, "Spawned", new List <Symbol>()
            {
            });

            return(instance);
        }
Esempio n. 2
0
 public void RemoveInstance(ThingInstance instance)
 {
     instancesToDelete.Add(instance);
 }
Esempio n. 3
0
 public void AddInstance(ThingInstance instance)
 {
     instancesToAdd.Add(instance);
     instance.Region = this;
 }