32 lines
761 B
C#
32 lines
761 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class FinishLineScript : MonoBehaviour
|
||
|
{
|
||
|
private GameHandler _gameHandler;
|
||
|
// Start is called before the first frame update
|
||
|
void Awake()
|
||
|
{
|
||
|
_gameHandler = GameHandler.Instance;
|
||
|
_gameHandler.OnAttemptEnding += Destroy_OnAttemptEnding;
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
gameObject.transform.position += new Vector3(-_gameHandler.FrameDistance, 0, 0);
|
||
|
}
|
||
|
|
||
|
public void Destroy_OnAttemptEnding(object sender, EventArgs args)
|
||
|
{
|
||
|
Destroy(gameObject);
|
||
|
}
|
||
|
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
GameHandler.Instance.OnAttemptEnding -= Destroy_OnAttemptEnding;
|
||
|
}
|
||
|
}
|