示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        canvas = GameObject.FindGameObjectWithTag("Canvas");
        keyOb  = GameObject.FindGameObjectWithTag("KeyUI");
        r      = GameObject.FindGameObjectWithTag("ResettableObjects");

        resettableObjects = r.GetComponent <UnityStandardAssets.Utility.ObjectResetter>();
        keyOb.SetActive(false);
        sm = new SoundManager();
        sm.InitSoundManager();
        a = gameObject.AddComponent <AudioSource>();
        sm.PlaySoundByName(a, "BGMDrums", true, 0.5f, 1.0f);
        inventory = gameObject.AddComponent <Inventory>();
        inventory.Initialize(this);
    }
 // implementing one method from monobehviour to ensure that the enable/disable tickbox appears in the inspector
 private void Start()
 {
     m_ObjectResetter = GetComponent<ObjectResetter>();
 }