Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType <RobotControl>();
        if (player != null)
        {
            playerRB = player.GetComponent <Rigidbody>();
        }
        //
        shootPoint = transform.Find("Shoot Point");
        if (shootPoint == null)
        {
            shootPoint = transform.Find("Barrel/Shoot Point");
        }
        //
        originalRotation = transform.localRotation;
        //
        audioSource = GetComponent <AudioSource>();
        //
        bodyRb = GetComponentInParent <Rigidbody>();
        // Registramos las correspondientes balas en el pool
        bulletPool = FindObjectOfType <BulletPool>();
        Bullet bulletData = proyectilePrefab.GetComponent <Bullet>();

        bulletPool.RegisterBullets(proyectilePrefab, rateOfFire, bulletData.lifeTime);
    }
Beispiel #2
0
 // Start is called before the first frame update
 void Start()
 {
     player = FindObjectOfType <RobotControl>();
     if (player != null)
     {
         playerRB = player.GetComponent <Rigidbody>();
     }
 }
Beispiel #3
0
    IEnumerator startMissiles()
    {
        RobotControl.GetComponent <Animator>().SetInteger("Arms", 4);

        yield return(new WaitForSeconds(2));

        for (int i = 0; i < amountMissiles; i++)
        {
            Director.sharedDirector().playEffect(missel);

            Instantiate(missiles, positionMissiles[0].position, positionMissiles[0].rotation);

            yield return(new WaitForSeconds(2));

            Director.sharedDirector().playEffect(missel);

            Instantiate(missiles, positionMissiles[1].position, positionMissiles[1].rotation);


            yield return(new WaitForSeconds(3));
        }

        yield return(StartCoroutine(RobotControl.idleRobot()));
    }