Script

download Script

If you can't read please download the document

description

Script game

Transcript of Script

//CODE TURRET_AI (Done)public void Attack(bool attackingRight){cooldownTembakan += Time.deltaTime;if (cooldownTembakan >= intervalTembakan) {Vector2 = target.transform.position - transform.position;if(!attackingRight){GameObject bulletClone;bulletClone = Instantiate(bullet, shootPointLeft.transform.position, shootPointLeft.transform.rotation) as GameObject;bulletClone.GetComponent().velocity = kecepatanTembakan;cooldownTembakan = 0;}if(attackingRight){GameObject bulletClone;bulletClone = Instantiate(bullet, shootPointRight.transform.position, shootPointRight.transform.rotation) as GameObject;bulletClone.GetComponent().velocity = direction * kecepatanTembakan;cooldownTembakan = 0;}}}//ATTACK_CONE (Done)void OnTriggerStay2D(Collider2D col){if (col.CompareTag ("Player")) {if(isLeft){turretAI.Attack(false);}else{turretAI.Attack(true);}}}