Exemplo n.º 1
0
    private void InteractWithBuyable(BuyableWeapons buyable)
    {
        if (gameManager.points < buyable.cost)
        {
            return;
        }

        if (GetOwnWeapon(buyable.ID) != null)
        {
            uiManager.UpdateInteractableText(buyable.name + "Ammo: $" + buyable.ammoCost.ToString());
            if (CheckInteractionInput() == false)
            {
                return;
            }
            GetOwnWeapon(buyable.ID).MaxOutAmmo();
            gameManager.ConsumePoints(buyable.ammoCost);
        }
        else
        {
            uiManager.UpdateInteractableText(buyable.name + ": $" + buyable.cost.ToString());
            if (CheckInteractionInput() == false)
            {
                return;
            }
            AssignWeapon(buyable.ID, buyable.packAPunched);
            gameManager.ConsumePoints(buyable.cost);
        }
        if (buyable.machine)
        {
            buyable.gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
    private void CheckInteractions()
    {
        RaycastHit hit;

        if (!Physics.Raycast(GetRay(), out hit, interactionDistance))
        {
            //turn UI off
            uiManager.UpdateInteractableText("");
            return;
        }
        Drink          drink      = hit.transform.GetComponent <Drink>();
        MysteryBox     mysteryBox = hit.transform.GetComponent <MysteryBox>();
        PackAPunch     packAPunch = hit.transform.GetComponent <PackAPunch>();
        BuyableWeapons buyable    = hit.transform.GetComponent <BuyableWeapons>();
        Obstacle       obstacle   = hit.transform.GetComponent <Obstacle>();

        if (buyable != null)
        {
            InteractWithBuyable(buyable);
        }
        else if (drink != null)
        {
            InteractWithDrink(drink);
        }
        else if (mysteryBox != null)
        {
            InteractWithMysteryBox(mysteryBox);
        }
        else if (packAPunch != null)
        {
            InteractWithPackAPunch(packAPunch);
        }
        else if (obstacle != null)
        {
            uiManager.UpdateInteractableText(obstacle.blockedArea + ": $" + obstacle.cost.ToString());
            if (CheckInteractionInput() == false)
            {
                return;
            }
            if (gameManager.points < obstacle.cost)
            {
                return;
            }
            obstacle.Buy();
            gameManager.ConsumePoints(obstacle.cost);
        }
    }
Exemplo n.º 3
0
 private void DeactivateWeapons(BuyableWeapons weapon)
 {
     weapon.gameObject.SetActive(false);
 }