void OnTriggerEnter(Collider other) { GameObject hitObject = other.gameObject; if (hitObject.tag == "Player" && renderer.enabled) { weaponController = hitObject.GetComponent <PlayerWeapons>(); if (!weaponController.HasWeaponCheck("SniperRifle")) { weaponController.AddWeapon("SniperRifle"); weaponController.SetCurrentWeapon("SniperRifle"); renderer.enabled = false; StartCoroutine(PickupReturn()); } else if (!weaponController.IsFullCheck("SniperRifle")) { curAmmo = weaponController.GetSniperCurrentAmmo(); weaponController.SetCurrentWeapon("SniperRifle"); weaponController.SetWeaponCurrentAmmo(curAmmo + plusAmmo); renderer.enabled = false; StartCoroutine(PickupReturn()); } } }
public void Buy(GameObject player) { PlayerWeapons playerWeapons = player.GetComponent <PlayerWeapons>(); PlayerMoney playerMoney = player.GetComponent <PlayerMoney>(); if (playerWeapons && playerMoney && playerMoney.currentMoney >= weaponPrice) { playerWeapons.AddWeapon(weapon); playerMoney.LooseMoney(weaponPrice); } }
public void PickUp(GameObject player) { PlayerWeapons playerWeapons = player.GetComponentInParent <PlayerWeapons>(); if (playerWeapons) { Debug.Log("Pick Up" + gameObject.name); playerWeapons.AddWeapon(weapon); player.GetComponentInChildren <PlayerInteraction>().RemoveFocus(); Destroy(gameObject); } }
public void UpdateWeaponList(IState state, string propertyPath, ArrayIndices arrayIndices) { int index = arrayIndices[0]; IPlayerState s = (IPlayerState)state; if (s.Weapons[index].ID == -1) { _playerWeapons.RemoveWeapon(index); } else { _playerWeapons.AddWeapon((WeaponID)s.Weapons[index].ID); } }
void OnTriggerEnter(Collider other) { GameObject hitObject = other.gameObject; if( hitObject.tag == "Player" && renderer.enabled ) { weaponController = hitObject.GetComponent<PlayerWeapons>(); if( ! weaponController.HasWeaponCheck("SniperRifle") ) { weaponController.AddWeapon("SniperRifle"); weaponController.SetCurrentWeapon("SniperRifle"); renderer.enabled = false; StartCoroutine( PickupReturn() ); } else if ( ! weaponController.IsFullCheck("SniperRifle") ) { curAmmo = weaponController.GetSniperCurrentAmmo(); weaponController.SetCurrentWeapon("SniperRifle"); weaponController.SetWeaponCurrentAmmo( curAmmo + plusAmmo ); renderer.enabled = false; StartCoroutine( PickupReturn() ); } } }