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); }
public void RemoveInstance(ThingInstance instance) { instancesToDelete.Add(instance); }
public void AddInstance(ThingInstance instance) { instancesToAdd.Add(instance); instance.Region = this; }