public async Task <ForgelightActor> CreateActor(string name, Transform parent) { ForgelightActor actorSource; if (!cachedActors.TryGetValue(name, out actorSource)) { Adr actorDefinition = actorDefinitionManager.GetDefinition(name); if (actorDefinition != null) { actorSource = await LoadNewActor(actorDefinition); } else { actorSource = CreateMissingPlaceholder(name); } actorSource.name = name; actorSource.Init(actorDefinition); actorSource.transform.SetParent(actorPoolParent.transform); cachedActors[name] = actorSource; } ForgelightActor actorInstance = Object.Instantiate(actorSource, parent); return(actorInstance); }
public ActorFactory(GameManager gameManager, ForgelightActor missingActorPrefab) { this.missingActorPrefab = missingActorPrefab; gameManager.OnGameLoaded += OnGameLoaded; }