wip: add aim
This commit is contained in:
@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.Barracuda;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
using static scr_Models;
|
||||
|
||||
@ -11,6 +12,7 @@ public class scr_CharacterController : MonoBehaviour
|
||||
|
||||
private CharacterController characterController;
|
||||
private DefaultInput defaultInput;
|
||||
|
||||
[HideInInspector]
|
||||
public Vector2 input_Movement;
|
||||
[HideInInspector]
|
||||
@ -59,6 +61,11 @@ public class scr_CharacterController : MonoBehaviour
|
||||
public scr_WeaponController currentWeapon;
|
||||
|
||||
public float weaponAnimationSpeed;
|
||||
|
||||
public float damage = 10f;
|
||||
public float range = 100f;
|
||||
|
||||
public Camera fpsCam;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -86,17 +93,31 @@ public class scr_CharacterController : MonoBehaviour
|
||||
{
|
||||
currentWeapon.Initialise(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetButtonDown("Fire1"))
|
||||
{
|
||||
Shoot();
|
||||
}
|
||||
CalculateView();
|
||||
CalculateMovement();
|
||||
CalculateJump();
|
||||
CalculateCameraHeight();
|
||||
}
|
||||
|
||||
void Shoot()
|
||||
{
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
|
||||
{
|
||||
Debug.Log(hit.transform.name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CalculateView()
|
||||
{
|
||||
newCharacterRotation.y += playerSettings.ViewXSensetivity * (playerSettings.ViewXInverted ? -input_View.x : input_View.x) * Time.deltaTime;
|
||||
|
Reference in New Issue
Block a user