Beispiel #1
0
 private void Start()
 {
     playerController = GameObject.Find("Perso").GetComponent <PlayerController>();
     itemCharge       = GetComponent <ItemCharge>();
     activeItem       = GetComponentInChildren <ItemDetection>();
     Shoot            = DoShoot;
     controller       = GetComponent <PlayerController>();
 }
Beispiel #2
0
    IEnumerator ShootIntervale()
    {
        yield return(new WaitForSeconds(shootIntervale));

        shoot = false;
        controller.moveSpeed = 8;
        yield return(Shoot = DoShoot);
    }
Beispiel #3
0
    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;
    }
Beispiel #4
0
    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;
    }
Beispiel #5
0
    IEnumerator ShootInvervalle()
    {
        yield return(new WaitForSeconds(shootIntervale));

        Shoot = DoShoot;
    }
Beispiel #6
0
 private void Start()
 {
     Shoot       = DoShoot;
     perso       = GameObject.Find("CenterPC").GetComponent <Transform>();
     pathFinding = GetComponent <PathFinding>();
 }