コード例 #1
0
    private void Start()
    {
        RB = GetComponent <Rigidbody>();

        _sound = new DoorSounds(RB.gameObject);

        doorT      = transform.parent;
        commonRot  = transform.rotation;
        close_time = close_time_cd;
        this.tag   = "Door";
        in_range   = false;

        changing = false;
    }
コード例 #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        DoorSounds sounds = (DoorSounds)target;

        foreach (FieldInfo sound in sounds.GetType().GetFields())
        {
            if (sound.FieldType == typeof(Sound))
            {
                Sound tempSound = sound.GetValue(sounds) as Sound;

                if (tempSound.clip != null && GUILayout.Button(tempSound.clip.name))
                {
                    _previewer.clip   = tempSound.clip;
                    _previewer.volume = tempSound.volume;
                    _previewer.Play();
                }
            }
        }
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     doorSound = GetComponent <DoorSounds>();
     pc        = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
 }