2D(dragon) 을 왼쪽으로 계속 이동 시켜 주기
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class dragon : MonoBehaviour
{
public float speed = 2f;
private bool stepped = false;
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.collider.tag == "Player" && !stepped)
{
stepped = true;
GameManager.instance.AddScore(10);
stepped = false;
}
}
void Update()
{
transform.Translate(Vector2.left * speed * Time.deltaTime);
}
}