예제 #1
0
파일: Thing.cs 프로젝트: vinczead/rpg
        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);
        }
예제 #2
0
파일: Region.cs 프로젝트: vinczead/rpg
 public void RemoveInstance(ThingInstance instance)
 {
     instancesToDelete.Add(instance);
 }
예제 #3
0
파일: Region.cs 프로젝트: vinczead/rpg
 public void AddInstance(ThingInstance instance)
 {
     instancesToAdd.Add(instance);
     instance.Region = this;
 }