コード例 #1
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;
        }
    }
コード例 #2
0
ファイル: SlotSelection.cs プロジェクト: Westonini/Dreadworks
    void Awake()
    {
        PS  = pistol.GetComponent <PlayerShooting>();
        UCI = GameObject.FindGameObjectWithTag("Player").GetComponent <UseConsumableItem>();

        try
        {
            CCO = GameObject.FindGameObjectWithTag("CarryOverInventory").GetComponent <CarryOverInventory>();
        }
        catch
        {
            CCO = null;
        }
    }