示例#1
0
        public void CreateActorWithoutParameters()
        {
            var actor = _actorFactory.Create();

            actor.Id.Should().BeGreaterOrEqualTo(0);
            actor.Components.Should().NotBeNull();
        }
示例#2
0
        protected override TActor CreateEntity(Type?actorType, int id, IComponent[]?components)
        {
            var actor = actorType == null
                ? _actorFactory.Create(components, id)
                : _actorFactory.Create(actorType, components, id);

            return((TActor)actor);
        }
示例#3
0
        public Actor Create(IComponent[]?components = null)
        {
            var actor = _actorFactory.Create(components);

            Actors.Add(actor);

            return(actor);
        }
示例#4
0
        public void RegisterNewActor(string name, string tag, string assetTag)
        {
            var instance = actorFactory.Create(assetTag);

            instance.Transform.SetParent(actorView, false);
            instance.Enabled = false;
            actors[name]     = instance;
        }
示例#5
0
 public static PID Spawn <T>(this IContext context, IActorFactory factory) where T : IActor =>
 context.Spawn(Props.FromProducer(() => factory.Create <T>()));
示例#6
0
 public static PID SpawnPrefix <T>(this IContext context, IActorFactory factory) where T : IActor =>
 context.SpawnPrefix(Props.FromProducer(() => factory.Create <T>()), typeof(T).Name);
示例#7
0
 public readonly Actor Build()
 {
     return(_actorFactory.Create(_components.ToArray(), _id));
 }