private void Update() { CheckInput(); playerRay = cam.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2)); if (currentWeapon != null && currentWeapon.gameObject.activeSelf == false) { currentWeapon = null; } if (currentWeapon == null && hand.childCount > 0) { currentWeapon = hand.GetComponentInChildren <WeaponBase>(); if (currentWeapon != null) { currentWeapon.CallStart(); } } if (currentExplosive == null && hand.childCount > 0) { currentExplosive = hand.GetComponentInChildren <ExplosiveBase>(); if (currentExplosive != null) { currentExplosive.CallStart(); } } if (currentWeapon != null && currentWeapon.gameObject.activeSelf && !PlayerController.instance.toggleEscMenu) { currentWeapon.CallUpdate(); } if (currentExplosive != null && currentExplosive.gameObject.activeSelf && !PlayerController.instance.toggleEscMenu) { currentExplosive.CallUpdate(); } if (Input.GetButton("Fire2")) { animator.SetBool("AimHandgun", true); } else { animator.SetBool("AimHandgun", false); } }
private void Start() { localStats = GetComponent <Stats>(); animator = GetComponent <SyncAnimator>(); instance = this; if (hand.childCount > 0) { currentWeapon = hand.GetComponentInChildren <WeaponBase>(); if (currentWeapon != null) { currentWeapon.CallStart(); } currentExplosive = hand.GetComponentInChildren <ExplosiveBase>(); if (currentExplosive != null) { currentExplosive.CallStart(); } } Console.Toggle(); }