Example #1
0
    public IEnumerator Attacking()
    {
        WaitForSeconds waiting = new WaitForSeconds(1);
        float          atkAngle;

        while (true)
        {
            Debug.Log("Player is targeting" + targetEnemy.name);
            if (enemies.Count > 0)
            {
                atkAngle           = Mathf.Atan2(transform.position.z - targetEnemy.transform.position.z, transform.position.x - targetEnemy.transform.position.x) * Mathf.Rad2Deg;
                transform.rotation = Quaternion.Euler(0, atkAngle, 0);
                // transform.LookAt(targetEnemy.transform);
                BulletPulling.Dequeue(transform);
            }
            yield return(waiting);
        }
    }
Example #2
0
 public override void Attack(GameObject target)
 {
     PlayerComponent.transform.LookAt(target.transform.position);
     BulletPulling.Dequeue(PlayerComponent.transform);
 }
 protected void Attack()
 {
     BulletPulling.Dequeue(transform);
 }