// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2020-09-02
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
using UnityEngine;
namespace G
{
///
///
///
public class BulletPet3 : MonoBehaviour
{
private Transform _fx;
//private LineRenderer _myline;
private Vector3 _targetPos;
private Vector3 _direction;
private float _delay;
private void Awake()
{
//_myline = GetComponent();
_fx = transform.GetChild(0);
this.gameObject.SetActive(false);
}
private void OnEnable()
{
_targetPos = transform.position + transform.forward * 0.3f;
_targetPos.y = 0.005f;
_direction = transform.forward;
_direction.y = 0f;
_delay = 2.8f;
transform.rotation = Quaternion.identity;
_fx.forward = _direction;
}
private void Update()
{
_direction += _fx.right * Time.deltaTime * 6f;
_direction.y = 0f;
_targetPos += _direction * Time.deltaTime * 1f;
Vector3 position = EntityPet.Instance.position;
//_myline.SetPosition(0, position);
//_myline.SetPosition(1, _targetPos);
_fx.position = _targetPos;
_fx.forward = _direction;
if (_delay < 0f)
{
EntityPet.Instance.AttackFinish();
this.gameObject.SetActive(false);
}
_delay -= Time.deltaTime;
}
}
}