private void Start() { playerController = GameObject.Find("Perso").GetComponent <PlayerController>(); itemCharge = GetComponent <ItemCharge>(); activeItem = GetComponentInChildren <ItemDetection>(); Shoot = DoShoot; controller = GetComponent <PlayerController>(); }
IEnumerator ShootIntervale() { yield return(new WaitForSeconds(shootIntervale)); shoot = false; controller.moveSpeed = 8; yield return(Shoot = DoShoot); }
IEnumerator waitShoot() { Shoot = DontShoot; yield return(new WaitForSeconds(0.15f)); FindObjectOfType <AudioManager>().Play("Tirer"); GameObject fireBullet = Instantiate(bulletPrefab, firePoint.position, firePoint.rotation); fireBullet.GetComponent <Rigidbody2D>().velocity = firePoint.right * bulletForce; }
private void DoShoot() { StopCoroutine(nameof(ShootInvervalle)); isShooting = true; pCDirection = (perso.transform.position - transform.position).normalized * bulletForce; for (int i = 0; i < firePoint.Length; i++) { GameObject fireBullet = Instantiate(bulletPrefab, firePoint[i].position, firePoint[i].rotation); fireBullet.GetComponent <Rigidbody2D>().velocity = new Vector2(pCDirection.x, pCDirection.y); } Shoot = dontShoot; }
IEnumerator ShootInvervalle() { yield return(new WaitForSeconds(shootIntervale)); Shoot = DoShoot; }
private void Start() { Shoot = DoShoot; perso = GameObject.Find("CenterPC").GetComponent <Transform>(); pathFinding = GetComponent <PathFinding>(); }