//AMMO BAG SECTION void GenerateBag() { AmmoBag[] allTypeInGame = PlayerManager.instance.AllTypeInGame; allAmmo = new AmmoBag[allTypeInGame.Length]; for (int i = 0; i < allTypeInGame.Length; i++) { allAmmo[i] = new AmmoBag(); allAmmo[i].type = allTypeInGame[i].type; allAmmo[i].amount = allTypeInGame[i].maxSize; allAmmo[i].maxSize = allTypeInGame[i].maxSize; } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("PlayerBody")) { Player_Controller player = other.GetComponentInParent <Player_Controller>(); _playerCapCollider = other.GetComponent <CapsuleCollider>(); if (player != null && _playerCapCollider != null) { AmmoBag ammoBag = player.GetAmmoBag; if (ammoBag != null) { ammoBag.RestockAmmo(_ammoCount); } } Destroy(gameObject); } }
private void Start() { goal = transform.position + new Vector3(Random.insideUnitSphere.x * 5, 0, Random.insideUnitSphere.z * 5); mayhemGunshotTimer = Random.Range(0.1f, 1); mayhemRotateTimer = Random.Range(0.1f, 0.5f); _uiManager = GameObject.Find("Canvas").GetComponent <UI_Manager>(); if (_uiManager == null) { Debug.LogError("The UI Manager is NULL!"); } ammoBag = GetComponent <AmmoBag>(); _audioManager = GameObject.Find("Audio Manager").GetComponent <AudioManager>(); _bulletController = GetComponent <Bullet_Controller>(); _playerRb = GetComponent <Rigidbody>(); //Instantiate aim target prefab if (_targetIndicatorPrefab) { _targetObject = Instantiate(_targetIndicatorPrefab, Vector3.zero, Quaternion.identity) as GameObject; } //Hide the cursor Cursor.visible = false; }
//AMMO BAG SECTION //Generate bas bag of all ammo void GenerateBag() { AmmoBag[] allTypeInGame = PlayerManager.instance.AllTypeInGame; allAmmo = new AmmoBag[allTypeInGame.Length]; for(int i = 0;i<allTypeInGame.Length;i++){ allAmmo[i] = new AmmoBag(); allAmmo[i].type = allTypeInGame[i].type; allAmmo[i].amount = allTypeInGame[i].maxSize; allAmmo[i].maxSize = allTypeInGame[i].maxSize; } }
public void IsInAmmoBag(AmmoBag a_ammoBag) { ammoBagInRange = a_ammoBag; }