void Start() { //security checks attachedAnimator = GetComponent <Animator>(); if (attachedAnimator == null) { Debug.LogError(gameObject.name + ": There must be an Animator component attached to this game object for the sliding animation to work."); } //security checks: look for camera in scene, make sure proper component is attached GameObject mainCameraObject = GameObject.FindGameObjectWithTag("MainCamera"); if (mainCameraObject == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera. It is necessary for item pick-up behaviour."); } else { mainCamera = mainCameraObject.GetComponent <MainCameraBehaviour>(); if (mainCamera == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera Behaviour component attached to the Inventory Manager game object. It is necessary for item pick-up behaviour."); } } }
public void InitialChecks() { //security checks: look for inventory manager in scene, make sure proper component is attached GameObject inventoryManagerObject = GameObject.FindGameObjectWithTag("InventoryManager"); if (inventoryManagerObject == null) { Debug.LogError(gameObject.name + ": Can't find the Inventory Manager game object. It is necessary for item pick-up behaviour."); } else { inventoryManager = inventoryManagerObject.GetComponent <InventoryManager>(); if (inventoryManager == null) { Debug.LogError(gameObject.name + ": Can't find the InventoryManager component attached to the Inventory Manager game object. It is necessary for item pick-up behaviour."); } } //security checks: look for camera in scene, make sure proper component is attached GameObject mainCameraObject = GameObject.FindGameObjectWithTag("MainCamera"); if (mainCameraObject == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera. It is necessary for item pick-up behaviour."); } else { mainCamera = mainCameraObject.GetComponent <MainCameraBehaviour>(); if (mainCamera == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera Behaviour component attached to the Inventory Manager game object. It is necessary for item pick-up behaviour."); } } //find the last keyframe of the shake curve Keyframe lastKeyframeShake = ProjectileData.cameraShakeCurve[ProjectileData.cameraShakeCurve.length - 1]; cameraShakeCurveEndTime = lastKeyframeShake.time; //find the last keyframe of the throw strength curve Keyframe lastKeyframeThrow = ProjectileData.throwStrengthCurve[ProjectileData.throwStrengthCurve.length - 1]; throwStrengthCurveEndTime = lastKeyframeThrow.time; //TEMPORARY, BUG-PRONE projectileSource = GameObject.FindGameObjectWithTag("ProjectileSource"); throwBarUI = GameObject.FindGameObjectWithTag("ThrowPercentage"); weaponAudioSource = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>(); //weaponAudioSource.clip = ProjectileData.throwBarHoldSound; }
public void InitialChecks() { //security checks: look for inventory manager in scene, make sure proper component is attached GameObject inventoryManagerObject = GameObject.FindGameObjectWithTag("InventoryManager"); if (inventoryManagerObject == null) { Debug.LogError(gameObject.name + ": Can't find the Inventory Manager game object. It is necessary for item pick-up behaviour."); } else { inventoryManager = inventoryManagerObject.GetComponent <InventoryManager>(); if (inventoryManager == null) { Debug.LogError(gameObject.name + ": Can't find the InventoryManager component attached to the Inventory Manager game object. It is necessary for item pick-up behaviour."); } } //security checks: look for camera in scene, make sure proper component is attached GameObject mainCameraObject = GameObject.FindGameObjectWithTag("MainCamera"); if (mainCameraObject == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera. It is necessary for item pick-up behaviour."); } else { mainCamera = mainCameraObject.GetComponent <MainCameraBehaviour>(); if (mainCamera == null) { Debug.LogError(gameObject.name + ": Can't find the Main Camera Behaviour component attached to the Inventory Manager game object. It is necessary for item pick-up behaviour."); } } //find the last keyframe of the shake curve Keyframe lastKeyframe = GunData.cameraShakeCurve[GunData.cameraShakeCurve.length - 1]; cameraShakeCurveEndTime = lastKeyframe.time; //TEMPORARY, BUG-PRONE projectileSource = GameObject.FindGameObjectWithTag("ProjectileSource"); gunAudioSource = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>(); //debug: start will full magazine magazineCurrentSize = GunData.magazineSize; }