init
This commit is contained in:
commit
862afc9b7a
478 changed files with 197737 additions and 0 deletions
33
Assets/Scripts/Checkpoint.cs
Normal file
33
Assets/Scripts/Checkpoint.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Checkpoint : MonoBehaviour
|
||||
{
|
||||
Animator anim;
|
||||
bool active;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.tag == "Player" && !active)
|
||||
{
|
||||
AudioManager.instance.Play("Checkpoint");
|
||||
anim.SetBool("Active", true);
|
||||
Debug.Log("Checkpoint at X" + transform.position.x + " Y" + transform.position.y);
|
||||
collision.GetComponent<PlayerStats>().checkpoint = transform.position;
|
||||
collision.GetComponent<PlayerStats>().checkpoint.y += 1;
|
||||
active = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue