public void SelectNPC(LA2NPC npc) { foreach (var kv in SM.npcActorManager.npcProperties) { if (kv.Key == npc) { if (kv.Value.isSelected) { return; } else { kv.Value.isSelected = true; } } else if (kv.Value.isSelected) { kv.Value.isSelected = false; } } ClearUserSelection(); ClearPlayerSelection(); SelectionChangedEvent?.Invoke(); }
private void RemoveNPC(LA2NPC npc) { _actionQueue.Enqueue(() => { var np = npcProperties[npc]; Destroy(np.gameObject); npcProperties.Remove(npc); }); }
private void AddNPC(LA2NPC npc) { npcProperties.Add(npc, new ActorProperties()); { _actionQueue.Enqueue(() => { var newActor = Instantiate(NPCActorPrefab, WorldUtils.L2ToUnityCoords(npc.X, npc.Y, 0), WorldUtils.ActorDefaultRotation()); var nas = newActor.GetComponent <NPCActorScript>(); nas.npc = npc; npc.ExpiredEvent += RemoveNPC; var np = npcProperties[npc]; np.gameObject = newActor; np.actorScript = nas; }); } }