This commit is contained in:
CortexCore
2023-10-02 23:24:56 +08:00
parent 8ef5c7ec0a
commit 947e52e748
183 changed files with 107857 additions and 9378 deletions

View File

@@ -17,7 +17,9 @@
"GUID:900280954c76a0d41bc47cef37f91107",
"GUID:1235ca61e7f433b408ed5a68767e7123",
"GUID:0a8b74b3309f0cc44bdd9a796253baef",
"GUID:8d74bfb2f67c5c14a810215b78383d40"
"GUID:8d74bfb2f67c5c14a810215b78383d40",
"GUID:96f476e982d6fb945bfc9140ba094b7f",
"GUID:4307f53044263cf4b835bd812fc161a4"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -68,7 +68,6 @@ namespace BITFALL.Guns
//简单设置
[Header(Constant.Header.Settings)]
[SerializeField] private Vector3 bulletInitialOffset;
[SerializeField] private int initialAimFov = 60;
[SerializeField] private SpringEulerAngle recoilSpring=new();
// 输入系统

View File

@@ -1,4 +1,5 @@
using System.Data.Odbc;
using BITFALL.Player.Equip;
using BITFALL.Player.Movement;
using BITKit;
using BITKit.Entities;
@@ -147,10 +148,12 @@ namespace BITFALL.Guns.States
public class Aim : GunState
{
private IEntityMovement _entityMovement;
private IEquipService _equipService;
public override void Initialize()
{
base.Initialize();
_entityMovement = root.Entity.Get<IEntityMovement>();
_equipService = root.Entity.Get<IEquipService>();
}
public override void OnStateEntry(IState old)
@@ -165,7 +168,7 @@ namespace BITFALL.Guns.States
root.animator.CrossFade(BITGun._Aim, 0.16f);
break;
}
_equipService.Zoom.Allow = true;
_entityMovement.ExecuteCommand<PlayerCancelRunCommand>();
}
@@ -188,6 +191,13 @@ namespace BITFALL.Guns.States
{
root.TransitionState<Movement>();
}
_equipService.Zoom.Value = root.aimAction.action.ReadValue<float>();
}
public override void OnStateExit(IState old, IState newState)
{
base.OnStateExit(old, newState);
_equipService.Zoom.Allow = false;
}
public override void OnMovementStateChanged(IEntityMovementState old, IEntityMovementState newState)

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITFALL.Player.Equip;
using BITKit;
using BITKit.Entities;
using UnityEngine;
@@ -18,15 +19,23 @@ namespace BITFALL.Player.Movement
private Quaternion currentRotation;
private Vector3 currentPosition;
private IEntityMovement _movement;
private IEquipService _equipService;
public override void OnAwake()
{
_movement = entity.Get<IEntityMovement>();
_equipService = entity.Get<IEquipService>();
}
public override void OnLateUpdate(float deltaTime)
{
var velocity = _movement.LocomotionBasedVelocity;
var angularVelocity = _movement.AngularVelocity;
if (_equipService.Zoom.Allow)
{
velocity = default;
angularVelocity = default;
}
currentPosition = Vector3.Lerp(currentPosition,velocity * posValue,posDelta * deltaTime);
currentRotation = Quaternion.Lerp(currentRotation,Quaternion.Euler(angularVelocity * rotValue),rotDelta * deltaTime);