22 lines
439 B
C#
22 lines
439 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Hammer : MonoBehaviour
|
|
{
|
|
private float _life = 3;
|
|
private void Awake()
|
|
{
|
|
Destroy(gameObject, _life);
|
|
}
|
|
|
|
private void OnCollisionEnter2D(Collision2D collision)
|
|
{
|
|
var player = collision.collider.GetComponent<Player>();
|
|
if (player == null)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|