/// <summary> /// Aims at the target if required /// </summary> protected virtual void TestAimAtTarget() { if (!AimAtTarget) { return; } if (_characterHandleWeapon.CurrentWeapon != null) { if (_weaponAim == null) { _weaponAim = _characterHandleWeapon.CurrentWeapon.gameObject.MMGetComponentNoAlloc <WeaponAim>(); } if (_weaponAim != null) { if (_projectileWeapon != null) { _projectileWeapon.DetermineSpawnPosition(); _weaponAimDirection = _brain.Target.position - (_projectileWeapon.SpawnPosition); } else { _weaponAimDirection = _brain.Target.position - _characterHandleWeapon.CurrentWeapon.transform.position; } } } }
/// <summary> /// Aims at the target if required /// </summary> protected virtual void TestAimAtTarget() { if (!AimAtTarget) { return; } if (_characterHandleWeapon.CurrentWeapon != null) { if (_weaponAim == null) { _weaponAim = _characterHandleWeapon.CurrentWeapon.gameObject.GetComponentNoAlloc <WeaponAim>(); } if (_weaponAim != null) { //******* New code to stop shooting at player's feet ******************** Vector3 targetPosition = new Vector3(_brain.Target.position.x, _brain.Target.position.y + 1.3f, 0); if (_projectileWeapon != null) { _projectileWeapon.DetermineSpawnPosition(); _weaponAimDirection = targetPosition - (_projectileWeapon.SpawnPosition); //NEW CODE FOR FEET SHOOTING FIX //_weaponAimDirection = _brain.Target.position - (_projectileWeapon.SpawnPosition); //OLD CODE FOR FEET SHOOTING FIX } else { _weaponAimDirection = targetPosition - _characterHandleWeapon.CurrentWeapon.transform.position; //NEW CODE FOR FEET FIX //_weaponAimDirection = _brain.Target.position - _characterHandleWeapon.CurrentWeapon.transform.position; //OLD CODE FOR FEET FIX } } } }