コード例 #1
0
    IEnumerator RapidFire()
    {
        print("TEST");
        GameObject   gun     = GameObject.Find("FPSController/FirstPersonCharacter/PM-40_Variant1/");
        RayCastShoot raycast = gun.GetComponent <RayCastShoot>();


        raycast.fireRate    = 0.14f;
        raycast.currentAmmo = 30;
        raycast.maxAmmo     = 30;
        raycast.SetAmmoText();

        GameObject textUI    = GameObject.Find("HUD/PowerType/");
        Text       powerType = textUI.GetComponent <Text>();

        powerType.text = "Rapid Fire!";

        //print("PowerupGiven");

        yield return(new WaitForSeconds(30f));

        raycast.fireRate = 0.25f;
        if (raycast.currentAmmo > 15)
        {
            raycast.currentAmmo = 15;
        }

        raycast.maxAmmo = 15;
        raycast.SetAmmoText();
        powerType.text = "Powerup Removed";
        print("Powerup Removed");

        yield return(new WaitForSeconds(5f));

        powerType.text = "";

        GameObject    anotherPowerup = GameObject.Find("PowerupLocations/");
        DeployPowerup deploy         = anotherPowerup.GetComponent <DeployPowerup>();

        yield return(new WaitForSeconds(5f));

        deploy.ChooseSpawners(2);
        print("ANOTHER POWERUP SPAWNED");

        // Remove Powerup
        Destroy(gameObject);
        //print("GameObject removed");
    }
コード例 #2
0
    IEnumerator RapidFire()
    {
        GameObject   gun     = GameObject.Find("FPSController/FirstPersonCharacter/PM-40_Variant1/");
        RayCastShoot raycast = gun.GetComponent <RayCastShoot>();

        print("TEST");
        raycast.fireRate    = 0.1f;
        raycast.currentAmmo = 30;
        raycast.maxAmmo     = 30;
        raycast.SetAmmoText();
        //print("PowerupGiven");

        yield return(new WaitForSeconds(10f));

        raycast.fireRate    = 0.25f;
        raycast.currentAmmo = 15;
        raycast.maxAmmo     = 15;
        raycast.SetAmmoText();
        print("Powerup Removed");

        // Remove Powerup
        Destroy(gameObject);
        //print("GameObject removed");
    }