예제 #1
0
    public void Pickup(GameObject itemObject, ItemScriptableObject iso, Vector2Int position)
    {
        currentItems++;
        iso.OnPickup(this);
        itemsInEqGO.Add(itemObject.GetComponent <Item>());

        foreach (var skill in iso.SkillsToLearn)
        {
            gameManager.LearnSkill(skill);
        }

        try { MapManager.map[position.x, position.y].item = null; }
        catch {}

        if (itemObject.GetComponent <Item>().identified == true)
        {
            gameManager.UpdateMessages($"You picked up the <color={iso.I_color}>{iso.I_name}</color>.");
            gameManager.UpdateInventoryQueue($"<color={iso.I_color}>{iso.I_name}</color>");
        }
        else
        {
            gameManager.UpdateMessages($"You picked up the <color=purple>{iso.I_unInName}</color>.");
            gameManager.UpdateInventoryQueue($"<color=purple>{iso.I_unInName}</color>");
        }
        GameManager.manager.ApplyChangesInInventory(null);
        UpdateCapacity();
    }
예제 #2
0
    public void Start()
    {
        _viewRange = startingViewRange;

        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        statsCanvas = GameObject.Find("Stats");

        Head     = GameObject.Find("Helm").GetComponent <Text>();
        Body     = GameObject.Find("Chest").GetComponent <Text>();
        LHand    = GameObject.Find("LeftHand").GetComponent <Text>();
        RHand    = GameObject.Find("RightHand").GetComponent <Text>();
        Ring     = GameObject.Find("Ring").GetComponent <Text>();
        Legs     = GameObject.Find("Legs").GetComponent <Text>();
        Capacity = GameObject.Find("Capacity").GetComponent <Text>();

        _strengthButton  = GameObject.Find("strengthLevelUp");
        _dexterityButton = GameObject.Find("dexterityLevelUp");
        _enduranceButton = GameObject.Find("enduranceLevelUp");

        _strengthButton.SetActive(false);
        _dexterityButton.SetActive(false);
        _enduranceButton.SetActive(false);

        __strength  = 10;
        __dexterity = 10;
        __endurance = 10;

        __sanity = 100;
        __blood  = 100;

        __maxHp     = __strength + (__endurance * 2) - 10;
        __currentHp = __maxHp;

        __lvl        = lvl;
        __experience = experience;
        __experienceNeededToLvlUp = experienceNeededToLvlUp;
        __coins = coins;

        __experienceNeededToLvlUp = 10;
        //__experienceNeededToLvlUp = NextLevelXpReq();

        Capacity.text = "Capacity: 0" + " / " + maxWeight;

        effectsText = GameObject.Find("Effects").GetComponent <TextMeshProUGUI>();
        StartCoroutine(UpdateEffects());

        //Add starting weapon
        if (!startingWeapon)
        {
            return;
        }

        currentItems++;

        startingWeapon.OnPickup(this);

        GameObject g = Instantiate(gameManager.itemSpawner.itemPrefab);

        g.GetComponent <Item>().iso = startingWeapon;

        itemsInEqGO.Add(g.GetComponent <Item>());

        gameManager.UpdateInventoryQueue($"<color={startingWeapon.I_color}>{startingWeapon.I_name}</color>");
        UpdateCapacity();

        UpdateText(statType.sanity);
        UpdateText(statType.blood);
    }