using BehaviorDesigner.Runtime.Tactical;
using BehaviorDesigner.Runtime.Tactical.Tasks;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlyingEnemy : MonoBehaviour, IAttackAgent
{
public float shootForce;
public GameObject bullet;
public Transform firePoint;
public float fireRate = 0.1f;
public float attackDistance;
public float attackAngle;
float count;
public void Attack(Vector3 targetPosition)
{
count = 0;
transform.LookAt(targetPosition);
Transform Bullet = Instantiate(bullet.transform, firePoint.position, Quaternion.LookRotation(targetPosition));
Bullet.GetComponent<Rigidbody>().AddForce((targetPosition - Bullet.position).normalized * shootForce, ForceMode.Impulse);
}
public float AttackAngle()
{
return attackAngle;
}
public float AttackDistance()
{
return attackDistance;
}
public bool CanAttack()
{
if(count >= fireRate)
{
return true;
}
else
{
return false;
}
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
count += Time.deltaTime;
}
}