Beispiel #1
0
    void initializeObject()
    {
        totalPoints = 100;

        bonusAmmoCapasity = 0;

        bonusMuzzleVelocity = 0;

        isPaused = false;

        isDead = false;

        audioSource = GetComponent <AudioSource>();

        currentTimeScale = 1.0f;

        mainCamera = GameObject.FindWithTag("MainCamera");

        cameraScript = mainCamera.GetComponentInParent <Camera2DFollow>();

        lastActiveGun = WeaponController.Guns.Pistol;

        elapsedLives = totalLives;

        changeUserInfo();

        changeActiveGunSprite();
    }
Beispiel #2
0
    public void changeWeapon(WeaponController.Guns newGun)
    {
        tWeapon = WeaponController.instance.gunPrefabs[(int)newGun];

        if (totalPoints >= tWeapon.GetComponent <Weapon>().priceOfWeapon)
        {
            if (tNewPlayer.GetComponent <Player>().activeGun != newGun)
            {
                lastActiveGun = newGun;

                tNewPlayer.GetComponent <Player>().changeWeapon(newGun);

                changeActiveGunSprite();

                changeUserInfo();

                totalPoints -= tWeapon.GetComponent <Weapon>().priceOfWeapon;


                gunUpgradeAlertText.text = "Your New Gun Set!";
            }
            else
            {
                newGunAlertText.text = "It's your active gun!";
            }
        }
        else
        {
            newGunAlertText.text = "Insufficient Funds!";
        }
    }
    public void changeWeapon(WeaponController.Guns newGun)
    {
        if (playerArm.transform.childCount > 0)
        {
            Destroy(playerArm.transform.GetChild(0).gameObject);
        }

        tWeaponPoint    = playerArm.transform.position;
        tWeaponPoint.x += 0.094f;
        tWeaponPoint.y -= 0.063f;

        tObject = (GameObject)Instantiate(WeaponController.instance.gunPrefabs[(int)newGun], tWeaponPoint, WeaponController.instance.gunPrefabs[(int)newGun].transform.rotation);
        tObject.transform.parent        = playerArm.transform;
        tObject.transform.localRotation = Quaternion.Euler(0f, 0f, -90f);

        activeGun = newGun;
    }
    void initializeObject()
    {
        isDying = false;

        playerStats = PlayerStats.instance;

        playerStats.curHealth = playerStats.maxHealth;

        playerArm = transform.Find("PlayerArm").gameObject;

        activeGun = GameManager.instance.lastActiveGun;

        if (activeGun != playerArm.transform.GetChild(0).gameObject.GetComponent <Weapon>().gunType)
        {
            changeWeapon(activeGun);
        }
    }