Exemplo n.º 1
0
    public override void Init()
    {
        PositionKey found = PlanetSave.PNJs.Find(p => new Vector3(p.x, p.y, p.z) == transform.position);

        IDname = found.key;

        NPCWrap npcText = ResourcesManager.Instance.NPCs.objects.Find(npc => npc.ID == IDname);

        if (npcText != null)
        {
            _txtInfo = npcText;
        }

        budgetComponent = new BudgetComponent(IDname);
        if (GameManager.PARTY_TYPE == EPartyType.SAVE)
        {
            List <BudgetsSave> saves;
            ArrayExtensions.ToList(PlanetSave.GameStateSave.Budgets, out saves);
            BudgetsSave save = saves.Find(s => s.npcName == IDname);
            if (save != null)
            {
                budgetComponent.budget     = save.budget;
                budgetComponent.Investment = save.investment;
            }
        }
        if (InventoryPlayer.Instance)
        {
            CatchGivedObject();
        }
    }
        public BudgetsSave GenerateSave()
        {
            BudgetsSave newSave = new BudgetsSave();

            newSave.budget     = budget;
            newSave.investment = _investment;
            return(newSave);
        }
Exemplo n.º 3
0
    public static List <BudgetsSave> GenerateSave()
    {
        List <BudgetsSave> newSave = new List <BudgetsSave>();

        foreach (InteractablePNJ pnj in PNJs)
        {
            if (pnj.budgetComponent != null)
            {
                BudgetsSave save = pnj.budgetComponent.GenerateSave();
                save.npcName = pnj.IDname;
                newSave.Add(save);
            }
        }
        return(newSave);
    }