private void OnCardDefLoaded(string cardID, CardDef cardDef, object userData) { RDMDeckEntry entry = (RDMDeckEntry)userData; ActorLoadCallback callbackData = new ActorLoadCallback { choice = entry, cardDef = cardDef }; AssetLoader.Get().LoadActor(ActorNames.GetHandActor(entry.EntityDef, entry.Flair.Premium), new AssetLoader.GameObjectCallback(this.OnActorLoaded), callbackData, false); }
private void OnActorLoaded(string name, GameObject go, object callbackData) { if (go == null) { UnityEngine.Debug.LogWarning(string.Format("DeckHelper.OnActorLoaded() - FAILED to load actor \"{0}\"", name)); } else { Actor component = go.GetComponent <Actor>(); if (component == null) { UnityEngine.Debug.LogWarning(string.Format("DeckHelper.OnActorLoaded() - ERROR actor \"{0}\" has no Actor component", name)); } else { component.transform.parent = base.transform; SceneUtils.SetLayer(component, base.gameObject.layer); ActorLoadCallback callback = (ActorLoadCallback)callbackData; RDMDeckEntry choice = callback.choice; EntityDef entityDef = choice.EntityDef; CardDef cardDef = callback.cardDef; CardFlair cardFlair = choice.Flair; component.SetEntityDef(entityDef); component.SetCardDef(cardDef); component.SetCardFlair(cardFlair); component.UpdateAllComponents(); component.gameObject.name = cardDef.name + "_actor"; component.GetCollider().gameObject.AddComponent <DeckHelperVisual>().SetActor(component); this.m_actors.Add(component); if (this.HaveActorsForAllChoices()) { this.PositionAndShowChoices(); } else { component.Hide(); } } } }