Beispiel #1
0
    //Changes currently equipped item to whatever is passed in.
    public void ChangeSlots(GameObject selectedSlot)
    {
        if (pistol.activeSelf == true && currentlySelectedItem == "Pistol")
        {
            PS.CancelReload();
        }
        if (gauze.activeSelf == true && currentlySelectedItem == "Gauze" && UseConsumableItem.playerIsHealing)
        {
            UCI.StopHeal();
        }
        if (selectedSlot == pipebomb)
        {
            FindObjectOfType <AudioManager>().Play("BombSizzle");
        }
        else if (currentlySelectedItem == "Pipebomb")
        {
            FindObjectOfType <AudioManager>().Stop("BombSizzle");
        }

        nothingEquipped.SetActive(false);
        machete.SetActive(false);
        pistol.SetActive(false);
        pipebomb.SetActive(false);
        gauze.SetActive(false);
        key.SetActive(false);

        selectedSlot.SetActive(true);
        currentlySelectedItem = selectedSlot.name.ToString();
    }
Beispiel #2
0
    public void GetScripts() //get script components
    {
        try
        {
            PC = GameObject.FindWithTag("Player").GetComponent <PlayerController>();
        }
        catch
        {
            PC = null;
        }

        try
        {
            PS = GameObject.Find("Pistol").GetComponent <PlayerShooting>();
            if (PS != null)
            {
                PS.CancelReload();
            }
        }
        catch
        {
            PM = null;
        }

        try
        {
            PM = GameObject.Find("Machete").GetComponent <PlayerMelee>();
        }
        catch
        {
            PM = null;
        }

        try
        {
            UCI = GameObject.Find("Player").GetComponent <UseConsumableItem>();
            if (UCI != null && UseConsumableItem.playerIsHealing)
            {
                UCI.StopHeal();
            }
        }
        catch
        {
            UCI = null;
        }

        try
        {
            SS = GameObject.FindWithTag("Player").GetComponent <SlotSelection>();
        }
        catch
        {
            SS = null;
        }
    }