public override void ComponentOnInvoked() { if (timeSinceLastLaunch > launchDelay) { timeSinceLastLaunch = 0f; launcher.ParabolaLaunchProjectile(projetileToLaunch, muzzle.forward, launchHeight, launchForce, muzzle.position); } }
private void ChaseAndLob() { timeSinceLastAttack_insideRange += Time.deltaTime; //Sets up the navmesh agent so that it would chase the player: agent.SetDestination(baseBehavior.PlayerTransform.position); agent.isStopped = false; if (timeSinceLastAttack_outsideRange > attackDelay_outRange) { //Lob a projectile after a certain amount of seconds: projectileLauncher.ParabolaLaunchProjectile(projectilePrefab, DirectionToPlayer(), lobHeight, lobPower, launchLocation.position); timeSinceLastAttack_outsideRange = 0f; } else { timeSinceLastAttack_outsideRange += Time.deltaTime; } }