Пример #1
0
    internal static NpcInteraction Create(NetworkPlayer interactor, NetworkNpc npcObj, int actionId = 0)
    {
        var data = npcObj.Data;

        actionId = (actionId == -1 ? data.Actions[0] : data.Actions.FirstOrDefault(x => x.Id == actionId)).Id;
        return(new NpcInteraction()
        {
            Interactor = interactor,
            NetworkNpc = npcObj,
            ActionId = actionId
        });
    }
Пример #2
0
    private void HandleNpcInteraction(NetworkNpc targetNpc, int actionId)
    {
        var myPlayer = playerManager.Me;

        if (!myPlayer)
        {
            return;
        }

        var npc = targetNpc;

        if (npc)
        {
            myPlayer.MoveToAndInteractWith(NpcInteraction.Create(myPlayer, npc, actionId), CheckIfRunning());
        }
    }