Esempio n. 1
0
        public void CreateActorWithoutParameters()
        {
            var actor = _actorFactory.Create();

            actor.Id.Should().BeGreaterOrEqualTo(0);
            actor.Components.Should().NotBeNull();
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public Actor Create(IComponent[]?components = null)
        {
            var actor = _actorFactory.Create(components);

            Actors.Add(actor);

            return(actor);
        }
Esempio n. 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;
        }
Esempio n. 5
0
 public static PID Spawn <T>(this IContext context, IActorFactory factory) where T : IActor =>
 context.Spawn(Props.FromProducer(() => factory.Create <T>()));
Esempio n. 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);
Esempio n. 7
0
 public readonly Actor Build()
 {
     return(_actorFactory.Create(_components.ToArray(), _id));
 }