Beispiel #1
0
    public void Awake()
    {
        bgm = gameObject.AddComponent<CriAtomSource>();
        bgm.cueSheet = cueSheetName;

        Button startButton = transform.FindChild("StartButton").GetComponent<Button>();
        Button stopButton = transform.FindChild("StopButton").GetComponent<Button>();
        startButton.onClick.AsObservable()
            .Subscribe(_ =>
            {
                if (bgm.IsPaused())
                {
                    bgm.Pause(false);
                } else
                {
                    Debug.Log("play!!");
                    bgm.Play(cueName);
                }
            });
        stopButton.onClick.AsObservable()
            .Subscribe(_ =>
            {
                if (!bgm.IsPaused())
                {
                    bgm.Pause(true);
                }
            });
    }
 private void OnEnable()
 {
     this.source = (CriAtomSource)base.target;
 }
Beispiel #3
0
    //AnimationState _backMusicState;

	// Use this for initialization
	void Start () {
        audioSource = GetComponent<AudioSource>();
		criAtomSource = GetComponent<CriAtomSource>();
        _animation = GetComponent<Animation>();
		if (audioSource) 
			DefaultVolume = audioSource .volume;
		if (criAtomSource)
			DefaultVolume = criAtomSource .volume;
        _defaultAnimSpeed = Tempo / 60.0f;
        _markerOffSetTime = 60.0f / Tempo * 2;
		oneRhythmTime = 60.0f / Tempo;
        _mainState = _animation[gameObject.name];
        //_backMusicState = _backAnimation["BackMusic"];
        //_backMusicState.speed = DefaultAnimSpeed;
        //_mainState.speed = _defaultAnimSpeed;

        GetComponent<MarkerEmitter>().SetTime = _markerOffSetTime;
	}
	//private bool showPreview = true;
	#endregion

	#region Functions
	private void OnEnable()
	{
		this.source = (CriAtomSource)base.target;
		this.style = new GUIStyle();
	}