Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
[+] added checkpoint component
[+] added "last checkpoint component" to gameManager (should be placed elsewhere.¯\_(ツ)_/¯
  • Loading branch information
pkurras committed May 23, 2018
1 parent 641aea6 commit 145f5a7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Assets/Scripts/CheckpointComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UnityEngine;

public class CheckpointComponent : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.tag == "Player")
{
GameManager.GetInstance().lastCheckpoint = this.gameObject;
}
}
}
12 changes: 12 additions & 0 deletions Assets/Scripts/CheckpointComponent.cs.meta

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

1 change: 1 addition & 0 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class GameManager : MonoBehaviour {
static GameManager instance;

public bool alive = false;
public GameObject lastCheckpoint;

private void Awake()
{
Expand Down

0 comments on commit 145f5a7

Please sign in to comment.