Exemplo n.º 1
0
    void Toggle_Shoot()
    {
        // var so player cant shoot when paused
        GameObject ship = GameObject.FindWithTag("Ship");

        if (ship != null)
        {
            // get scripts for each type of shot
            ShipFire       shootScript  = ship.GetComponent <ShipFire>();
            ShipDoubleShot doubleScript = ship.GetComponent <ShipDoubleShot>();
            ShipLongShot   longScript   = ship.GetComponent <ShipLongShot>();
            // then toggle them
            if (shootScript.ToggleShot == true && doubleScript.ToggleShot == true && longScript.ToggleShot == true)
            {
                shootScript.ToggleShot  = false;
                doubleScript.ToggleShot = false;
                longScript.ToggleShot   = false;
            }
            else if (shootScript.ToggleShot == false && doubleScript.ToggleShot == false && longScript.ToggleShot == false)
            {
                shootScript.ToggleShot  = true;
                doubleScript.ToggleShot = true;
                longScript.ToggleShot   = true;
            }
        }
    }
Exemplo n.º 2
0
    void RemovePowerup()
    {
        // reove only double shot at the moment
        ShipFire fireScript = Ship.GetComponent <ShipFire>();

        fireScript.enabled = true;
        ShipDoubleShot doubleShotScript = Ship.GetComponent <ShipDoubleShot>();

        doubleShotScript.enabled = false;
    }
Exemplo n.º 3
0
    // Long Shot
    public void Power4()
    {
        // find the ship
        GameObject ship = GameObject.FindWithTag("Ship");
        // get the shoot scripts
        ShipFire       singleFire = ship.GetComponent <ShipFire> ();
        ShipDoubleShot doubleShot = ship.GetComponent <ShipDoubleShot> ();
        ShipLongShot   longShot   = ship.GetComponent <ShipLongShot> ();

        // Disable single fire and doubleshot
        singleFire.enabled = false;
        doubleShot.enabled = false;
        // Enable longshot
        longShot.enabled = true;
    }
Exemplo n.º 4
0
    void RemovePowerup()
    {
        GameObject   gameManager = GameObject.Find("GameManager");
        LoadSettings script      = gameManager.GetComponent <LoadSettings> ();

        switch (script.shipNumber)
        {
        case 1:
            ShipFire fireScript = Ship.GetComponent <ShipFire>();
            fireScript.enabled = true;
            ShipDoubleShot doubleShotScript = Ship.GetComponent <ShipDoubleShot>();
            doubleShotScript.enabled = false;
            break;

        case 2:
            ShipShield shieldScript = Ship.GetComponent <ShipShield>();
            shieldScript.SpawnShield = false;
            break;
        }
    }