35 lines
846 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dot : MonoBehaviour
{
public float Score;
public bool SuperDot;//閉撰飪赽
private void Awake()
{
}
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.layer == LayerMask.NameToLayer("PacMan"))
{
if (SuperDot && !collision.gameObject.GetComponent<PacMan>().invincible)
{
collision.gameObject.GetComponent<PacMan>().invincible = true;//扢离翋褒拸菩
}
else if(SuperDot)
{
collision.gameObject.GetComponent<PacMan>().timer = 0; //笭离拸菩奀潔
}
GameManager.instance.AddScore(Score);
Destroy(this.gameObject);
}
}
}