Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKey("space") && (canShoot || isRockGod)) || (Input.GetKeyDown("space") && isRockOn))
        {
            if (!isRockGod)
            {
                Instantiate(bullet, player.transform.position, Quaternion.identity);
            }
            else
            {
                Instantiate(godBullet, new Vector3(player.transform.position.x, 0.0f, 0.0f), Quaternion.identity);
                spawning.godBulletFired();
            }

            shootTimer = 0.0f;

            canShoot = false;
        }

        shootTimer += Time.deltaTime;
        if (shootTimer >= (1.0f / shootRate) || (isRockOn && shootTimer >= (1.0f / rockOnShootRate)))
        {
            canShoot = true;
        }

        // Activate Rock ON meter if it's full and the player hits C
        if (Input.GetKeyDown(KeyCode.C) && spawning.getRockOn() == 1.0f && !isRockGod)
        {
            isRockOn = true;
        }
        else if (spawning.getRockOn() == 0.0f)
        {
            isRockOn = false;
        }

        // Activate God mode if the Rock GOD meter is full and the player hits V
        if (Input.GetKey(KeyCode.V) && spawning.getRockGod() == 1.0f && !isRockOn)
        {
            GetComponent <Animator>().SetTrigger("jaxGM");
            isRockGod = true;
        }
        else if (spawning.getRockGod() == 0.0f)
        {
            if (isRockGod)
            {
                GetComponent <Animator>().SetTrigger("jaxIdle");
            }
            isRockGod = false;
        }
    }