void Start() { animator = GetComponent <Animator>(); if (applyRecoilToCamera) { tpCamera = FindObjectOfType <vThirdPersonCamera>(); } ammoManager = GetComponent <vAmmoManager>(); usingThirdPersonController = GetComponent <vThirdPersonController>() != null; if (useAmmoDisplay) { ammoDisplay = FindObjectOfType <vAmmoDisplay>(); } if (animator) { var _rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand); var weapon = _rightHand.GetComponentInChildren <vShooterWeapon>(); if (weapon != null) { SetRightWeapon(weapon.gameObject); } } if (!ignoreTags.Contains(gameObject.tag)) { ignoreTags.Add(gameObject.tag); } if (useAmmoDisplay && ammoDisplay) { ammoDisplay.UpdateDisplay(""); } }
protected virtual void HideAmmoDisplay(vAmmoDisplay ammoDisplay) { if (useAmmoDisplay && ammoDisplay) { ammoDisplay.UpdateDisplay(""); ammoDisplay.Hide(); } }
void Start() { animator = GetComponent <Animator>(); if (applyRecoilToCamera) { tpCamera = FindObjectOfType <vCamera.vThirdPersonCamera>(); } ammoManager = GetComponent <vAmmoManager>(); ammoManager.updateTotalAmmo = new vAmmoManager.OnUpdateTotalAmmo(AmmoManagerWasUpdated); var tpInput = GetComponent <vThirdPersonController>(); usingThirdPersonController = tpInput; if (usingThirdPersonController && useCancelReload) { tpInput.onReceiveDamage.AddListener(CancelReload); } if (useAmmoDisplay) { GetAmmoDisplays(); } if (animator) { var _rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand); var _lefttHand = animator.GetBoneTransform(HumanBodyBones.LeftHand); var weaponR = _rightHand.GetComponentInChildren <vShooterWeapon>(); var weaponL = _lefttHand.GetComponentInChildren <vShooterWeapon>(); if (weaponR != null) { SetRightWeapon(weaponR.gameObject); } if (weaponL != null) { SetLeftWeapon(weaponL.gameObject); } } if (!ignoreTags.Contains(gameObject.tag)) { ignoreTags.Add(gameObject.tag); } if (useAmmoDisplay) { if (ammoDisplayR) { ammoDisplayR.UpdateDisplay(""); } if (ammoDisplayL) { ammoDisplayL.UpdateDisplay(""); } } UpdateTotalAmmo(); }