示例#1
0
    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();
    }
示例#2
0
 private void RemoveNPC(LA2NPC npc)
 {
     _actionQueue.Enqueue(() =>
     {
         var np = npcProperties[npc];
         Destroy(np.gameObject);
         npcProperties.Remove(npc);
     });
 }
示例#3
0
 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;
         });
     }
 }