using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    private GameObject playerObj;
    private GameObject enemyObj;
    private Vector2 vec2;
    private float speedData;
    private Rigidbody2D rb2;
    
    // Start is called before the first frame update
    void Start()
    {
        //5秒後に消す
        Destroy(gameObject,5.0f);
        
        //コンポーネント取得
        rb2 = GetComponent<Rigidbody2D>();
        
        //スピード係数
        speedData = 5.0f;
        
        //プレイヤーと敵のオブジェクト取得
        playerObj = GameObject.Find("Player");
        enemyObj = GameObject.Find("Enemy");
        
        //距離の差分を出し、斜辺を求める
        

        //斜辺からXとYの移動量を求める
        //X座標の加速度をvec2.xに代入してください
        //Y座標の加速度をvec2.yに代入してください
        
    }

    // Update is called once per frame
    void Update()
    {
        //移動
        rb2.velocity = new Vector2(vec2.x * speedData, vec2.y * speedData);
        
        //当たり判定
        
    }
}
