using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnityEngine;
public class Bird : MonoBehaviour
{
public float force;
Rigidbody2D BirdRigid;
void Start()
{
BirdRigid = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0)) {
BirdRigid.velocity = Vector2.up * force;
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.collider.tag == "Enemy")
{
Destroy(gameObject);
}
}
}
Вот код