Ejemplo n.º 1
0
    void Start()
    {
        this.anim = GetComponent <Animator>();

        hud = hudObject.GetComponent <HUD>();

        stats = hud.statsObject.GetComponent <Stats>();

        ammo = hud.ammoObject.GetComponent <Ammo>();

        stats.SetHP(healthPoints);
        stats.SetArmor(armor);


        gunDataBase = gunDataBaseObject.GetComponent <GunDataBase>();
        List <GunInfo> pistols = new List <GunInfo>();

        foreach (var g in (gunDataBase.Guns))
        {
            pistols.Add(g.GetComponent <GunInfo>());
        }

        unlockedGuns.AddRange(pistols);

        Quest       newQ        = new Quest();
        QuestResult questResult = new QuestResult();

        newQ.isActive = true;
        newQ.check    = QuestFunctionsList.ScarLUnlockCheck;
        newQ.doresult = QuestFunctionsList.ScalLUnclockDoResult;
        newQ.quest_id = "unlock_scarL";

        questResult.header      = "Unlocked new gun";
        questResult.description = "Name: " + gunDataBase.GetById("Assault_scarl").GetComponent <GunInfo>().DisplayName + '\n'
                                  + "Rarity: " + gunDataBase.GetById("Assault_scarl").GetComponent <GunInfo>().Rarity.ToString();
        questResult.image = gunDataBase.GetById("Assault_scarl").GetComponent <SpriteRenderer>().sprite;


        newQ.result = questResult;

        quests.Add(newQ);


        foreach (var q in quests)
        {
            q.player = this;
        }
    }
Ejemplo n.º 2
0
    public void SelectGun(GunInfo info)
    {
        bool unlocked = player.unlockedGuns.Contains(info);


        if (unlocked)
        {
            var g = Instantiate(gunDataBase.GetById(info.item_id));
            if (player.itemInHand)
            {
                g.transform.position = player.transform.position;
            }
            else
            {
                player.item       = g;
                player.itemInHand = true;
                if (g.GetComponent <GunInfo>().weaponClass == WeaponClass.SniperRiffle)
                {
                    g.GetComponent <Sniper>().isOnPlayerHand = true;
                }
            }


            CloseShop();
        }
    }