Example #1
0
 private void Start()
 {
     if (FindObjectOfType <PlayerVars>().isActiveAndEnabled)
     {
         print("Found the Player");
         //Player_Controller playerInstance = FindObjectOfType<Player_Controller>();
         if (PlayerVars.Instance.health == 0)
         {
             PlayerVars.Instance.health = maxHealth;
         }
         currentHealth = PlayerVars.Instance.health;
     }
     //Sets player health to the Max Health value
     //currentHealth = maxHealth;
     //Sets Health UI text to the Max Health value
     healthBar.SetMaxHealth(maxHealth);
     healthBar.SetHealth(currentHealth);
     cargoText.text = "";
     ammoInMag.text = "Mag: " + weapon.ammoInMag.ToString();
     weapon.checkWeapon();
 }
Example #2
0
    private void Start()
    {
        if (FindObjectOfType <PlayerVars>().isActiveAndEnabled)
        {
            print("Found the Player's Bag");

            if (PlayerVars.Instance.slot1.weapontype == weaponType.none)
            {
                //Debug.Log("Setting weapons");
                PlayerVars.Instance.slot1 = gunObj.FindWeapon(1);
                // PlayerVars.Instance.slot2 = gunObj.FindWeapon(9);
                //temp for testing
                //PlayerVars.Instance.slot2 = gunObj.FindWeapon(17);
                print("pistol set");
            }
            SetGun1(PlayerVars.Instance.slot1);
            SetGun2(PlayerVars.Instance.slot2);
        }
        currnetWeapon = slot1;
        _playerWeapon = FindObjectOfType <PlayerWeapom>();
        //_playerWeapon.damage = 200;
        _playerWeapon.checkWeapon();
    }