void Start() { player = GetComponentInParent <PlayerController> (); weaponController = GetComponent <WeaponController> (); player.SwitchWeapon(weaponController); props = weaponController.AimingProps; aimData = weaponController.AimData; }
/// <summary> /// Shooting, if ray on target do hit shot, else do missed shot /// </summary> public void DoShot() { AimingProperties props = AimingProps; Ray ray = player.GetAimingRay(); RaycastHit HitInfo; bool isHit = Physics.Raycast(ray, out HitInfo, props.MaxDistance, props.ShotableItems, QueryTriggerInteraction.Collide); if (isHit) { GunObject.DoHitShot(HitInfo, props.MaxDistance); } else { GunObject.DoMissedShot(ray.GetPoint(props.MaxDistance)); } }