Esempio n. 1
0
    // every 2 seconds perform the print()
    private IEnumerator Attack()
    {
        while (true)
        {
            yield return(new WaitForSeconds(1 / attackSpeed));

            EnemyStats enemy = getTarget.GetTarget(GetTargetTower.TargetType.Closed);
            if (enemy == null)
            {
                continue;
            }
            barrel.LookAt(enemy.transform);

            mount.localEulerAngles = new Vector3(0, barrel.eulerAngles.y, 0);
            BulletScript.InstanceBullet(barrel, 10, bulletModel);
        }
    }