Ejemplo n.º 1
0
    /// <summary>
    /// Switch Range Weapons Helper Method
    /// </summary>
    private void WeaponSwitch()
    {
        if (Input.GetKeyDown(KeyCode.Q))
        {
            GunScript currentGunScript = playerGunPrefabs[weaponNum].GetComponent <GunScript>();

            // For particle guns turn off the particles if you switch weapons
            if (currentGunScript.Particles)
            {
                currentGunScript.Particles.SetActive(false);
            }
            // For charging gun shooting
            if (currentGunScript.Charging)
            {
                currentGunScript.Charging = false;

                // Shoot the Charging bullet if you switch guns while charging the bullet (shoot as though you call Fire Weapon)
                currentGunScript.bulletCopy.GetComponent <BulletManager>().Speed = currentGunScript.bulletSpeed;
                currentGunScript.JustShot();
            }

            // turn off the current gun sprite
            playerGunPrefabs[weaponNum].GetComponent <SpriteRenderer>().enabled = false;

            // If the gun doesn't exist increment and check if it's null
            do
            {
                weaponNum++;
                weaponNum %= 3;
            } while (playerGunPrefabs[weaponNum] == null);


            // turn on the current gun sprite
            playerGunPrefabs[weaponNum].GetComponent <SpriteRenderer>().enabled = true;
            currentRangeWeapon = playerGunPrefabs[weaponNum].GetComponent <GunScript>().gunType;

            // Have a delay so the player can't bypass the normal shooring mechanic delay by switching weapons
            playerGunPrefabs[weaponNum].GetComponent <GunScript>().JustSwitchGuns();
        }
    }
Ejemplo n.º 2
0
    void TextUpdate()
    {
        screwText.text = GameManager.instance.screws.ToString();
        // Print out Experience Number
        scoreText.text = GameManager.instance.experience.ToString();

        // Get variables needed for the HUD Text
        if (GameManager.DebugMode)
        {
            // Create the text for weapons
            currentRangeWeapon = player.CurrentRangeWeapon;
            string weaponString;

            switch (currentRangeWeapon)
            {
            case rangeWeapon.laserpistol:
                weaponString = "Laser Pistol";
                break;

            case rangeWeapon.aetherLightBow:
                weaponString = "AetherLight Bow";
                break;

            case rangeWeapon.antiEctoPlasmator:
                weaponString = "Anti-Ectoplasm Splatter Gun";
                break;

            case rangeWeapon.AntimatterParticle:
                weaponString = "Anti-Matter Particle Emitter";
                break;

            case rangeWeapon.CelestialRepeater:
                weaponString = "Celestial Repeater";
                break;

            case rangeWeapon.cryoGun:
                weaponString = "Frostweaver";
                break;

            case rangeWeapon.DarkEnergyRifle:
                weaponString = "Dark Energy Rifle";
                break;

            case rangeWeapon.ElectronSeeker:
                weaponString = "Electron Pulser";
                break;

            case rangeWeapon.flamethrower:
                weaponString = "Flamethrower";
                break;

            case rangeWeapon.hellfireshotgun:
                weaponString = "Hellfire Shotgun";
                break;

            case rangeWeapon.PlasmaCannon:
                weaponString = "Plasma Charger";
                break;

            case rangeWeapon.soundCannon:
                weaponString = "Sound Cannon";
                break;

            case rangeWeapon.XenonPulser:
                weaponString = "Xenon Pulser";
                break;

            default:
                weaponString = "No Weapon";
                break;
            }
            rangeWeaponText.text = "Current Weapon: " + weaponString;


            // Print out the level number
            levelText.text = "Level: " + (GameManager.instance.currentLevel);


            // Print out the FPS
            FPSText.text = "FPS: " + 1.0f / deltaTime;
        }
        else
        {
            levelText.text       = "";
            rangeWeaponText.text = "";
            FPSText.text         = "";
        }

        if (bossFight && boss != null)
        {
            bossText.text = boss.name + ": ";
        }
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        // Player Game Variables
        maxHealth      = GameManager.instance.healthTotal;
        currentHealth  = GameManager.instance.healthTotal;
        maxStamina     = GameManager.instance.staminaTotal;
        currentStamina = GameManager.instance.staminaTotal;
        shieldHealth   = 1;
        invincibility  = false;
        isSprinting    = false;
        //canMelee = true;
        canShield        = true;
        canTravel        = true;
        applypoison      = true; // Starts as true, turned to false only if poisoned
        poisoned         = false;
        poisonCounter    = 0;
        portalNum        = 0;
        weaponNum        = 0;
        playerGunPrefabs = new List <GameObject>();


        // Inventory Set Up
        playerItems = new ItemType[6];
        for (int i = 0; i < playerItems.Length; i++)
        {
            playerItems[i] = ItemType.NoItem;
        }

        #region Set up Guns for the player for the level
        // Gun Set Up

        for (int i = 0; i < GameManager.instance.currentGuns.Count; i++)
        {
            switch (GameManager.instance.currentGuns[i])
            {
            case rangeWeapon.aetherLightBow:
                playerGunPrefabs.Add(GameObject.Find("AetherLightBow"));
                break;

            case rangeWeapon.antiEctoPlasmator:
                playerGunPrefabs.Add(GameObject.Find("AntiEctoPlasmator"));
                break;

            case rangeWeapon.CelestialRepeater:
                playerGunPrefabs.Add(GameObject.Find("CelestialRepeater"));
                break;

            case rangeWeapon.cryoGun:
                playerGunPrefabs.Add(GameObject.Find("CryoGun"));
                break;

            case rangeWeapon.DarkEnergyRifle:
                playerGunPrefabs.Add(GameObject.Find("DarkMatterRifle"));
                break;

            case rangeWeapon.ElectronSeeker:
                playerGunPrefabs.Add(GameObject.Find("ElectronSeeker"));
                break;

            case rangeWeapon.flamethrower:
                playerGunPrefabs.Add(GameObject.Find("Flamethrower"));
                break;

            case rangeWeapon.hellfireshotgun:
                playerGunPrefabs.Add(GameObject.Find("HellFireShotGun"));
                break;

            case rangeWeapon.laserpistol:
                playerGunPrefabs.Add(GameObject.Find("LaserGun"));
                break;

            case rangeWeapon.PlasmaCannon:
                playerGunPrefabs.Add(GameObject.Find("PlasmaPistol"));
                break;

            case rangeWeapon.soundCannon:
                playerGunPrefabs.Add(GameObject.Find("SoundCannon"));
                break;

            case rangeWeapon.XenonPulser:
                playerGunPrefabs.Add(GameObject.Find("XenonPulser"));
                break;

            case rangeWeapon.AntimatterParticle:
                playerGunPrefabs.Add(GameObject.Find("AntiMatterParticle"));
                break;

            case rangeWeapon.Tempest:
                playerGunPrefabs.Add(GameObject.Find("Tempest"));
                break;

            case rangeWeapon.PreciousRevolver:
                playerGunPrefabs.Add(GameObject.Find("PreciousMetalRevolver"));
                break;

            default:
                playerGunPrefabs.Add(null);
                break;
            }
        }
        #endregion

        // If the gun doesn't exist increment and check if it's null
        while (playerGunPrefabs[weaponNum] == null)
        {
            weaponNum++;
            weaponNum %= 3;
        }
        currentRangeWeapon = playerGunPrefabs[weaponNum].GetComponent <GunScript>().gunType;

        // turn on the current gun sprite
        playerGunPrefabs[weaponNum].GetComponent <SpriteRenderer>().enabled = true;

        // Temp variables
        magnet         = true;
        magnetDistance = 1.5f;
    }