Merge remote-tracking branch 'origin/lisin/character/2' into lisin/character/2
# Conflicts: # Assets/Prefabs/PlayerPrefab/Player.prefab # Assets/Scenes/Greatest_map_ever/Greatest_map_ever.unity # Assets/Scripts/Weapons/Shooting.cs
This commit is contained in:
@ -2,18 +2,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class Shooting : MonoBehaviour
|
||||
{
|
||||
public GameObject raycast;
|
||||
|
||||
public GameObject firePoint;
|
||||
[SerializeField] private GameObject projectilePrefab;
|
||||
//[SerializeField] private ParticleSystem projectilePrefab;
|
||||
public ParticleSystem projectilePrefab;
|
||||
|
||||
private float hSliderValue = 0.1f;
|
||||
private float _fireCountdown = 0.1f;
|
||||
|
||||
public GameObject gun;
|
||||
public AudioSource audioSource;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
HandleMouseButton();
|
||||
@ -32,6 +35,7 @@ public class Shooting : MonoBehaviour
|
||||
|
||||
private void PlayerShoot()
|
||||
{
|
||||
audioSource.Play();
|
||||
Instantiate(projectilePrefab, firePoint.transform.position, firePoint.transform.rotation);
|
||||
if (Physics.Raycast(raycast.transform.position,
|
||||
raycast.transform.forward, out var hit,
|
||||
@ -50,7 +54,7 @@ public class Shooting : MonoBehaviour
|
||||
raycast.transform.forward, out var hit,
|
||||
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||
{
|
||||
if (hit.transform.TryGetComponent<ICharacter>(out var target))
|
||||
if (hit.transform.TryGetComponent<NPC>(out var target))
|
||||
{
|
||||
Instantiate(projectilePrefab, firePoint.transform.position, firePoint.transform.rotation);
|
||||
target.GetDamage(SettingsReader.Instance.GetSettings.RifleDamage);
|
||||
|
Reference in New Issue
Block a user