Skip to content

Commit

Permalink
ゲームオーバーできるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
mattak committed Jun 21, 2015
1 parent afb315b commit 5275ee2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Resources/Scripts/Main/CameraBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class CameraBehaviour : MonoBehaviour {

// Use this for initialization
void Start () {
IObservable<Vector3> positionObservable = Observable.EveryUpdate()
IObservable<Vector3> positionObservable = this.gameObject.UpdateAsObservable()
.Select (_ => { return trackObject.transform.position; });

positionObservable
Expand Down
27 changes: 27 additions & 0 deletions Assets/Resources/Scripts/Main/GameManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using UnityEngine;
using System;
using System.Collections;
using UniRx;
using UniRx.Triggers;

public class GameManager : MonoBehaviour {
public float timeLimit = 10.0f;

// Use this for initialization
void Start () {
this.gameObject.UpdateAsObservable()
.Take(1)
.Delay(TimeSpan.FromSeconds(timeLimit))
.Subscribe(_ => {
GameClear();
});
}

public void GameOver() {
Application.LoadLevel ("Over");
}

public void GameClear() {
Application.LoadLevel ("Clear");
}
}
12 changes: 12 additions & 0 deletions Assets/Resources/Scripts/Main/GameManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5275ee2

Please sign in to comment.