breakpoint
before change animation type
This commit is contained in:
Binary file not shown.
@@ -9,18 +9,6 @@ AnimatorOverrideController:
|
||||
m_Name: EntityRifle
|
||||
m_Controller: {fileID: 9100000, guid: cb43cb1bf42184e45b920b0bb77554f9, type: 2}
|
||||
m_Clips:
|
||||
- m_OriginalClip: {fileID: 7400000, guid: ad24d1ce30ed48945a9b68be9827bc90, type: 2}
|
||||
m_OverrideClip: {fileID: 8816525237524189043, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 01214145ea75a2d4b80363bba2f1a65e, type: 2}
|
||||
m_OverrideClip: {fileID: -5858036045953447646, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 451f983af0dd44c419406ca1d1a0b591, type: 2}
|
||||
m_OverrideClip: {fileID: 7433315730774535304, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 9bc28f4633c671a428bc05bc4b6e6a8c, type: 2}
|
||||
m_OverrideClip: {fileID: 197974373799447605, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 68182865c01bbae4fb3027ea32634e3f, type: 2}
|
||||
m_OverrideClip: {fileID: 541215467601930624, guid: f6c625b850088b948bf4a11919b23be2,
|
||||
type: 3}
|
||||
@@ -126,3 +114,15 @@ AnimatorOverrideController:
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 87615f3d6179d5149a4bd20a314bb372, type: 2}
|
||||
m_OverrideClip: {fileID: 806794535615196031, guid: 6515624bbb09409469ca9784688969a8,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 01214145ea75a2d4b80363bba2f1a65e, type: 2}
|
||||
m_OverrideClip: {fileID: -5858036045953447646, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: ad24d1ce30ed48945a9b68be9827bc90, type: 2}
|
||||
m_OverrideClip: {fileID: 8816525237524189043, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 451f983af0dd44c419406ca1d1a0b591, type: 2}
|
||||
m_OverrideClip: {fileID: 7433315730774535304, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
- m_OriginalClip: {fileID: 7400000, guid: 9bc28f4633c671a428bc05bc4b6e6a8c, type: 2}
|
||||
m_OverrideClip: {fileID: 197974373799447605, guid: 8458c01c2fdae5447bf770e0341e9ccb,
|
||||
type: 3}
|
||||
|
@@ -7,7 +7,7 @@ AvatarMask:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Pixel Upper Additive
|
||||
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||
m_Mask: 00000000010000000100000000000000000000000100000001000000010000000100000000000000000000000100000001000000
|
||||
m_Elements:
|
||||
- m_Path:
|
||||
m_Weight: 1
|
||||
|
@@ -7,7 +7,7 @@ AvatarMask:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Pixel Upper
|
||||
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||
m_Mask: 00000000010000000100000000000000000000000100000001000000010000000100000000000000000000000100000001000000
|
||||
m_Elements:
|
||||
- m_Path:
|
||||
m_Weight: 1
|
||||
|
Binary file not shown.
@@ -107,8 +107,8 @@ BoxCollider:
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 0.012339168, y: 0.025882503, z: 0.005909813}
|
||||
m_Center: {x: -1.571532e-17, y: 0.00089429616, z: -0.0013475455}
|
||||
m_Size: {x: 0.012339168, y: 0.025882503, z: 0.0035980714}
|
||||
m_Center: {x: -1.4127675e-18, y: 0.00089429616, z: -0.00019167557}
|
||||
--- !u!65 &8909336572364058817
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@@ -44,13 +44,12 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1610736432900663163}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 2, y: 0, z: 2}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3509096854786611592}
|
||||
- {fileID: 5612917868120347697}
|
||||
- {fileID: 261189247636088016}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -206,7 +205,7 @@ NavMeshAgent:
|
||||
m_GameObject: {fileID: 1610736432900663163}
|
||||
m_Enabled: 1
|
||||
m_AgentTypeID: 0
|
||||
m_Radius: 0.16
|
||||
m_Radius: 0.32
|
||||
m_Speed: 3.5
|
||||
m_Acceleration: 8
|
||||
avoidancePriority: 50
|
||||
@@ -215,7 +214,7 @@ NavMeshAgent:
|
||||
m_AutoTraverseOffMeshLink: 1
|
||||
m_AutoBraking: 0
|
||||
m_AutoRepath: 0
|
||||
m_Height: 2
|
||||
m_Height: 1.6
|
||||
m_BaseOffset: 0
|
||||
m_WalkableMask: 4294967295
|
||||
m_ObstacleAvoidanceType: 4
|
||||
@@ -359,7 +358,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: c78fe9fd58f5efc4abdeb6d193bf258b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
animator: {fileID: 673930142905110667}
|
||||
animator: {fileID: 0}
|
||||
rigidbodies:
|
||||
- {fileID: 6212079510373085893}
|
||||
- {fileID: 2627371083418363332}
|
||||
@@ -468,13 +467,29 @@ MonoBehaviour:
|
||||
- rid: 7707058030789525625
|
||||
type: {class: Idle, ns: BITFALL.Movement.MotionBased.States, asm: BITFALL.Entities.Movement.Runtime}
|
||||
data:
|
||||
clip: {fileID: -4391933643253906413, guid: 6e5372ccf7beb464e965194eb4d564e8,
|
||||
type: 3}
|
||||
clip: {fileID: 7400000, guid: 8a914a73777e46445af7079140a911a6, type: 3}
|
||||
- rid: 7707058030789525626
|
||||
type: {class: Walk, ns: BITFALL.Movement.MotionBased.States, asm: BITFALL.Entities.Movement.Runtime}
|
||||
data:
|
||||
clip: {fileID: -203655887218126122, guid: 372c0d71272a8fb4cbfa41f52ef78994,
|
||||
type: 3}
|
||||
_state:
|
||||
_FadeDuration: 0.25
|
||||
_Events:
|
||||
_NormalizedTimes: []
|
||||
_Callbacks: []
|
||||
_Names: []
|
||||
_Speed: 1
|
||||
_Animations:
|
||||
- {fileID: 7400000, guid: a1a9219f954bc644d8380dc091e54347, type: 3}
|
||||
- {fileID: 7400000, guid: 6fb4b5a9e960f374b966988f0807ae1a, type: 3}
|
||||
- {fileID: 7400000, guid: 503e6c5caa2ffa9469ac8986db8b0a03, type: 3}
|
||||
_Speeds: []
|
||||
_SynchronizeChildren:
|
||||
_Thresholds:
|
||||
- -1
|
||||
- 0
|
||||
- 1
|
||||
_DefaultParameter: 0
|
||||
_ExtrapolateSpeed: 1
|
||||
- rid: 7707058030789525638
|
||||
type: {class: IdleTurn, ns: BITFALL.Movement.MotionBased.States, asm: BITFALL.Entities.Movement.Runtime}
|
||||
data:
|
||||
@@ -512,9 +527,8 @@ MonoBehaviour:
|
||||
- {fileID: -203655887218126122, guid: 6c5cbd0e33d4ba742948bd8098f1beeb, type: 3}
|
||||
- Key: Melee
|
||||
Value:
|
||||
- {fileID: -203655887218126122, guid: d319bd8b8d6b0274f91bddd4691c70e6, type: 3}
|
||||
- {fileID: -203655887218126122, guid: cce3cdea83ca5d4488b9306b257adaa8, type: 3}
|
||||
- {fileID: -203655887218126122, guid: 2af77d9f71b3eef4c908b9396adeb551, type: 3}
|
||||
- {fileID: 7400000, guid: 7a068e9bd4d92a74faa3ca3c225ea7ab, type: 3}
|
||||
- {fileID: 7400000, guid: 4a410aae47385784da16b5814337ad97, type: 3}
|
||||
- Key: HitStun
|
||||
Value:
|
||||
- {fileID: -203655887218126122, guid: 82c9040f74a95ef4ca987d174540a848, type: 3}
|
||||
@@ -528,14 +542,15 @@ MonoBehaviour:
|
||||
- {fileID: -203655887218126122, guid: f5508ff7aab49d7438f7b931bb543fd4, type: 3}
|
||||
- Key: Death
|
||||
Value:
|
||||
- {fileID: -203655887218126122, guid: 40e6b9a4c94e8984aa455def690dd91a, type: 3}
|
||||
- {fileID: -203655887218126122, guid: 055450a83fcb47f4a8c34eb6b457d5f8, type: 3}
|
||||
- {fileID: -203655887218126122, guid: a91772e7f4001264d870ee5a2cbc1048, type: 3}
|
||||
- {fileID: 7400000, guid: 509a212e9c348a74997ce6f304818732, type: 3}
|
||||
- {fileID: 7400000, guid: ee64f27c88f96304f91f1b945481dc2b, type: 3}
|
||||
- {fileID: 7400000, guid: c1d3b61ec26c27e4a9ef066aef8e0b2e, type: 3}
|
||||
- {fileID: 7400000, guid: dd782cce8d8754143ac43a11da776507, type: 3}
|
||||
avatarMasks:
|
||||
_serializedList:
|
||||
- Key: 16
|
||||
Value: {fileID: 31900000, guid: 263eecbb6a522144aac2b10bef460052, type: 2}
|
||||
allowDeathAnimation: 0
|
||||
allowDeathAnimation: 1
|
||||
--- !u!114 &2332545226796783687
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1187,7 +1202,7 @@ PrefabInstance:
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 5964803017347144284}
|
||||
m_TransformParent: {fileID: 8104504566599589718}
|
||||
m_Modifications:
|
||||
- target: {fileID: 6256051358093332725, guid: 2ad4d682518910847b19ed8106c0071a,
|
||||
type: 3}
|
||||
@@ -1212,17 +1227,17 @@ PrefabInstance:
|
||||
- target: {fileID: 6256051358093332725, guid: 2ad4d682518910847b19ed8106c0071a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6256051358093332725, guid: 2ad4d682518910847b19ed8106c0071a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6256051358093332725, guid: 2ad4d682518910847b19ed8106c0071a,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6256051358093332725, guid: 2ad4d682518910847b19ed8106c0071a,
|
||||
type: 3}
|
||||
@@ -1524,7 +1539,11 @@ PrefabInstance:
|
||||
- {fileID: 7613617252232372131, guid: 5f9e9216c9925af4bafec02dca8c438e, type: 3}
|
||||
- {fileID: 1311415486234117464, guid: 5f9e9216c9925af4bafec02dca8c438e, type: 3}
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedGameObjects:
|
||||
- targetCorrespondingSourceObject: {fileID: 2155766259452216820, guid: 5f9e9216c9925af4bafec02dca8c438e,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 5612917868120347697}
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 5f9e9216c9925af4bafec02dca8c438e, type: 3}
|
||||
--- !u!54 &797937506702059996 stripped
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
BIN
Assets/Artists/Scenes/Game/NewSix/NavMesh-Navmesh Surface.asset
Normal file
BIN
Assets/Artists/Scenes/Game/NewSix/NavMesh-Navmesh Surface.asset
Normal file
Binary file not shown.
@@ -22,6 +22,8 @@ namespace BITFALL.Entites
|
||||
[Inject] private IEntityOverride _override;
|
||||
|
||||
private readonly List<(Transform transform,Vector3 initialPosition, Quaternion initialRotation)> _initialJoint = new();
|
||||
|
||||
private bool _updateNextFrame;
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
@@ -44,6 +46,15 @@ namespace BITFALL.Entites
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
base.OnUpdate(deltaTime);
|
||||
if (_updateNextFrame)
|
||||
{
|
||||
EnsurePhysicsAnimation();
|
||||
_updateNextFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void EnsurePhysicsAnimation()
|
||||
@@ -55,14 +66,23 @@ namespace BITFALL.Entites
|
||||
physicsBasedAnimation.Value.allowGravity = !_health.IsAlive;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_override is not null)
|
||||
{
|
||||
animator.enabled = _health.IsAlive || _override.IsOvering;
|
||||
}
|
||||
else
|
||||
{
|
||||
animator.enabled = _health.IsAlive;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOverride(bool obj)
|
||||
{
|
||||
EnsurePhysicsAnimation();
|
||||
//EnsurePhysicsAnimation();
|
||||
_updateNextFrame = true;
|
||||
}
|
||||
public void OnSetAlive(bool alive)
|
||||
{
|
||||
@@ -76,7 +96,8 @@ namespace BITFALL.Entites
|
||||
x.transform.localPosition = x.initialPosition;
|
||||
}
|
||||
}
|
||||
EnsurePhysicsAnimation();
|
||||
//EnsurePhysicsAnimation();
|
||||
_updateNextFrame = true;
|
||||
}
|
||||
|
||||
public void OnSetHP(int hp)
|
||||
|
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Animancer;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Movement.MotionBased
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class MotionBasedClipTransition : ClipTransition, IMotionBasedAnimationState
|
||||
{
|
||||
object ICloneable.Clone() => MemberwiseClone();
|
||||
}
|
||||
[Serializable]
|
||||
public sealed class MotionBasedMixTransition : LinearMixerTransition, IMotionBasedAnimationState
|
||||
{
|
||||
object ICloneable.Clone() => MemberwiseClone();
|
||||
}
|
||||
}
|
@@ -38,23 +38,25 @@ namespace BITFALL.Movement.MotionBased
|
||||
{
|
||||
if (obj)
|
||||
{
|
||||
_override.RemoveOverride(-1);
|
||||
//_override.RemoveOverride(-1);
|
||||
animancerComponent.Layers[8].Stop();
|
||||
}
|
||||
else if( allowDeathAnimation)
|
||||
{
|
||||
animancerComponent.Layers[1].Stop();
|
||||
_override.AddOverride(-1);
|
||||
if (animationClips.TryGetValue("Death", out var clips) is false) return;
|
||||
var state = animancerComponent.Layers[8].Play(clips.Random());
|
||||
state.Events.OnEnd += OnEnd;
|
||||
return;
|
||||
void OnEnd()
|
||||
{
|
||||
_override.RemoveOverride(-1);
|
||||
state.Events.OnEnd = null;
|
||||
animancerComponent.Layers[8].Stop();
|
||||
}
|
||||
//animancerComponent.Layers[1].Stop();
|
||||
Play("Death",false,8);
|
||||
|
||||
// _override.AddOverride(-1);
|
||||
// if (animationClips.TryGetValue("Death", out var clips) is false) return;
|
||||
// var state = animancerComponent.Layers[8].Play(clips.Random());
|
||||
// state.Events.OnEnd += OnEnd;
|
||||
// return;
|
||||
// void OnEnd()
|
||||
// {
|
||||
// _override.RemoveOverride(-1);
|
||||
// state.Events.OnEnd = null;
|
||||
// animancerComponent.Layers[8].Stop();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +71,11 @@ namespace BITFALL.Movement.MotionBased
|
||||
// }
|
||||
}
|
||||
public void Play(string animationName)=>Play(animationName,false);
|
||||
public void Play(string animationName, bool isAdditive)
|
||||
public void Play(string animationName, bool isAdditive,int layer = -1)
|
||||
{
|
||||
if (animationClips.TryGetValue(animationName, out var clip) is false) return;
|
||||
var layer = isAdditive ? 2 : 1;
|
||||
layer = layer is -1 ? isAdditive ? 2 : 1 : layer;
|
||||
|
||||
if (string.IsNullOrEmpty(lastAnimationName) is false)
|
||||
{
|
||||
_override.RemoveOverride(lastAnimationName);
|
||||
@@ -90,6 +93,7 @@ namespace BITFALL.Movement.MotionBased
|
||||
{
|
||||
state.Events.OnEnd = null;
|
||||
animancerComponent.Layers[layer].Stop();
|
||||
UnityEntity.Invoke(Constant.Animation.OnPlayEnd,animationName);
|
||||
if (isAdditive is false)
|
||||
_override.RemoveOverride(animationName);
|
||||
}
|
||||
|
@@ -16,6 +16,14 @@ namespace BITFALL.Movement.MotionBased
|
||||
public interface IMotionBasedState : IEntityMovementState
|
||||
{
|
||||
void OnAnimatorMove();
|
||||
}
|
||||
public interface IMotionBasedAnimationState:ICloneable
|
||||
{
|
||||
}
|
||||
public interface IMotionBasedAnimationClip{}
|
||||
public abstract class MotionBasedAnimationState
|
||||
{
|
||||
|
||||
}
|
||||
[CustomType(typeof(MotionBasedMovement))]
|
||||
public sealed class MotionBasedMovement : StateBasedBehavior<IMotionBasedState>,IEntityMovement
|
||||
@@ -151,8 +159,7 @@ namespace BITFALL.Movement.MotionBased
|
||||
get => Transform.rotation;
|
||||
set => Transform.rotation = value;
|
||||
}
|
||||
|
||||
Vector3 IEntityMovement.Forward => Transform.forward;
|
||||
public Vector3 Forward => Rotation * Vector3.forward;
|
||||
|
||||
Vector3 IEntityMovement.ViewForward => Transform.forward;
|
||||
|
||||
|
@@ -7,6 +7,7 @@ using AYellowpaper.SerializedCollections;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using BITKit.StateMachine;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
using UnityEngine.Splines;
|
||||
@@ -21,6 +22,8 @@ namespace BITFALL.Movement.MotionBased.States
|
||||
[Inject] protected IHealth health;
|
||||
|
||||
protected Vector3 MotionVelocity { get; private set; }
|
||||
protected Vector3 MotionAngularVelocity { get; private set; }
|
||||
protected Quaternion MotionDeltaRotation { get; private set; }
|
||||
public virtual bool Enabled { get; set; }
|
||||
public virtual void Initialize()
|
||||
{
|
||||
@@ -63,6 +66,8 @@ namespace BITFALL.Movement.MotionBased.States
|
||||
public virtual void OnAnimatorMove()
|
||||
{
|
||||
MotionVelocity = animancerComponent.Animator.velocity;
|
||||
MotionAngularVelocity = animancerComponent.Animator.angularVelocity;
|
||||
MotionDeltaRotation = animancerComponent.Animator.deltaRotation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,11 +166,21 @@ namespace BITFALL.Movement.MotionBased.States
|
||||
[Serializable]
|
||||
public sealed class Walk : MotionBasedState
|
||||
{
|
||||
[SerializeField] private AnimationClip clip;
|
||||
[SerializeField] private LinearMixerTransition _state;
|
||||
|
||||
private AnimancerState _playingState;
|
||||
|
||||
private float rot = 0;
|
||||
public override void OnStateEntry(IState old)
|
||||
{
|
||||
base.OnStateEntry(old);
|
||||
animancerComponent.Play(clip,0.1f);
|
||||
_playingState = animancerComponent.Play(_state);
|
||||
}
|
||||
|
||||
public override void OnStateExit(IState old, IState newState)
|
||||
{
|
||||
base.OnStateExit(old, newState);
|
||||
_playingState = null;
|
||||
}
|
||||
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
@@ -198,18 +213,44 @@ namespace BITFALL.Movement.MotionBased.States
|
||||
public override void UpdateRotation(ref Quaternion currentRotation, float deltaTime)
|
||||
{
|
||||
base.UpdateRotation(ref currentRotation, deltaTime);
|
||||
|
||||
var pathRotation = currentRotation;
|
||||
var lerpRotation = currentRotation;
|
||||
|
||||
var direction = agent.steeringTarget - agent.transform.position;
|
||||
if(direction.sqrMagnitude>0.1f)
|
||||
{
|
||||
direction = Vector3.ProjectOnPlane(direction, Vector3.up);
|
||||
currentRotation =
|
||||
pathRotation = Quaternion.LookRotation(direction);
|
||||
lerpRotation =
|
||||
Quaternion.RotateTowards(
|
||||
currentRotation,
|
||||
Quaternion.LookRotation(direction),
|
||||
pathRotation,
|
||||
360 * deltaTime
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
if (_playingState is not null)
|
||||
{
|
||||
var dir = pathRotation * Vector3.forward; //位置差,方向
|
||||
var dot = Vector3.Dot(movement.Forward, dir.normalized);//点乘判断前后:dot >0在前,<0在后
|
||||
var dot1 = Vector3.Dot(movement.transform.right, dir.normalized);//点乘判断左右: dot1>0在右,<0在左
|
||||
var angle = Mathf.Acos(Vector3.Dot(movement.Forward.normalized, dir.normalized)) * Mathf.Rad2Deg;//通过点乘求出
|
||||
|
||||
angle = dot1 > 0 ? angle : -angle;
|
||||
|
||||
var clamp = Mathf.Clamp(angle/45, -1, 1);
|
||||
|
||||
rot = Mathf.MoveTowards(rot, clamp, 8 * deltaTime);
|
||||
|
||||
_state.State.Parameter =rot ;
|
||||
|
||||
//Debug.Log($"angle:{angle} dot:{dot} dot1:{dot1} clamp:{clamp}");
|
||||
|
||||
}
|
||||
currentRotation = lerpRotation;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,10 @@ namespace BITFALL.Entities.Player.Movement.States
|
||||
|
||||
public override void AfterUpdateMovement(float deltaTime)
|
||||
{
|
||||
if (knockdown.IsKnockdown)
|
||||
{
|
||||
characterController.TransitionState<Knockdown>();
|
||||
}
|
||||
if (knockdown.IsKnockdown is false && characterController.ExpectParachute.shouldBe)
|
||||
{
|
||||
characterController.TransitionState<Parachute>();
|
||||
@@ -216,6 +220,7 @@ namespace BITFALL.Entities.Player.Movement.States
|
||||
public override void AfterUpdateMovement(float deltaTime)
|
||||
{
|
||||
base.AfterUpdateMovement(deltaTime);
|
||||
if (characterController.CurrentState != this) return;
|
||||
switch (characterController.ExpectRun.shouldBe,characterController.ExpectCrouch.shouldBe)
|
||||
{
|
||||
case (_,true):
|
||||
|
@@ -15,8 +15,12 @@ namespace BITKit.Entities
|
||||
[SerializeField] private Collider[] ragdollColliders;
|
||||
[SerializeField] private Joint[] joints;
|
||||
[SerializeField] private new Rigidbody rigidbody;
|
||||
[Inject]
|
||||
|
||||
[Inject(true)]
|
||||
private IHealth _health;
|
||||
|
||||
[Inject(true)] private IEntityOverride _override;
|
||||
|
||||
private readonly Dictionary<Joint,ConfigurableJointMotion> _jointXMotions=new();
|
||||
private readonly Dictionary<Joint,ConfigurableJointMotion> _jointYMotions=new();
|
||||
private readonly Dictionary<Joint,ConfigurableJointMotion> _jointZMotions=new();
|
||||
@@ -27,7 +31,6 @@ namespace BITKit.Entities
|
||||
public override void OnAwake()
|
||||
{
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
_health.OnSetHealthPoint += OnSetHP;
|
||||
foreach (var x in joints)
|
||||
{
|
||||
switch (x)
|
||||
@@ -42,13 +45,34 @@ namespace BITKit.Entities
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_override is not null)
|
||||
_override.OnOverride += OnOverride;
|
||||
}
|
||||
|
||||
private async void OnSetAlive(bool alive)
|
||||
private void OnOverride(bool obj)
|
||||
{
|
||||
IsPhysics = !alive;
|
||||
EnsureConf();
|
||||
}
|
||||
|
||||
private void OnSetAlive(bool alive)
|
||||
{
|
||||
EnsureConf();
|
||||
}
|
||||
|
||||
private async void EnsureConf()
|
||||
{
|
||||
var allow = (_health, _override) switch
|
||||
{
|
||||
(not null,not null)=>_health.IsAlive || _override.IsOvering,
|
||||
(not null,null)=>_health.IsAlive,
|
||||
(null,not null)=>_override.IsOvering,
|
||||
_=>false,
|
||||
};
|
||||
if (animator)
|
||||
animator.enabled = alive;
|
||||
{
|
||||
animator.enabled = allow;
|
||||
}
|
||||
try
|
||||
{
|
||||
await Task.Delay(10, destroyCancellationToken);
|
||||
@@ -56,13 +80,13 @@ namespace BITKit.Entities
|
||||
foreach (var x in rigidbodies)
|
||||
{
|
||||
//x.isKinematic = alive;
|
||||
x.gameObject.SetActive(!alive);
|
||||
x.gameObject.SetActive(!allow);
|
||||
}
|
||||
foreach (var x in ragdollColliders)
|
||||
{
|
||||
x.enabled = !alive;
|
||||
x.enabled = !allow;
|
||||
}
|
||||
OnSetPhysics?.Invoke(!alive);
|
||||
OnSetPhysics?.Invoke(!allow);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
@@ -74,25 +98,20 @@ namespace BITKit.Entities
|
||||
switch (joint)
|
||||
{
|
||||
case ConfigurableJoint configurableJoint:
|
||||
configurableJoint.xMotion = alive ? _jointXMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.yMotion = alive ? _jointYMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.zMotion = alive ? _jointZMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.xMotion = allow ? _jointXMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.yMotion = allow ? _jointYMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.zMotion = allow ? _jointZMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.angularXMotion =
|
||||
alive ? _jointAngularXMotions[joint] : ConfigurableJointMotion.Free;
|
||||
allow ? _jointAngularXMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.angularYMotion =
|
||||
alive ? _jointAngularYMotions[joint] : ConfigurableJointMotion.Free;
|
||||
allow ? _jointAngularYMotions[joint] : ConfigurableJointMotion.Free;
|
||||
configurableJoint.angularZMotion =
|
||||
alive ? _jointAngularZMotions[joint] : ConfigurableJointMotion.Free;
|
||||
allow ? _jointAngularZMotions[joint] : ConfigurableJointMotion.Free;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void OnSetHP(int hp)
|
||||
{
|
||||
}
|
||||
|
||||
public Vector3 Center => rigidbody.worldCenterOfMass;
|
||||
public bool IsPhysics { get; private set; }
|
||||
public Vector3 Velocity
|
||||
|
306
Assets/Bakery/_tempScene.unity
Normal file
306
Assets/Bakery/_tempScene.unity
Normal file
@@ -0,0 +1,306 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 112000000, guid: 6fcbd6ef8df73ad4a9a140be3d235359,
|
||||
type: 2}
|
||||
m_LightingSettings: {fileID: 790793462}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &425500979
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 425500981}
|
||||
- component: {fileID: 425500980}
|
||||
m_Layer: 0
|
||||
m_Name: New Game Object
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!220 &425500980
|
||||
LightProbeGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425500979}
|
||||
m_Enabled: 1
|
||||
m_SourcePositions:
|
||||
- {x: 1, y: 1, z: 1}
|
||||
- {x: 1, y: 1, z: -1}
|
||||
- {x: 1, y: -1, z: 1}
|
||||
- {x: 1, y: -1, z: -1}
|
||||
- {x: -1, y: 1, z: 1}
|
||||
- {x: -1, y: 1, z: -1}
|
||||
- {x: -1, y: -1, z: 1}
|
||||
- {x: -1, y: -1, z: -1}
|
||||
m_Dering: 1
|
||||
--- !u!4 &425500981
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425500979}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.22130358, y: 2.148, z: -18.13}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!850595691 &790793462
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
serializedVersion: 6
|
||||
m_GIWorkflowMode: 1
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 1
|
||||
m_BakeBackend: 1
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 40
|
||||
m_Padding: 2
|
||||
m_LightmapCompression: 3
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 2
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 2
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 256
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentImportanceSampling: 1
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_PVRTiledBaking: 0
|
||||
m_NumRaysToShootPerTexel: -1
|
||||
m_RespectSceneVisibilityWhenBakingGI: 0
|
||||
--- !u!1 &891640504
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 891640506}
|
||||
- component: {fileID: 891640505}
|
||||
m_Layer: 0
|
||||
m_Name: New Game Object
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!220 &891640505
|
||||
LightProbeGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 891640504}
|
||||
m_Enabled: 1
|
||||
m_SourcePositions:
|
||||
- {x: 1, y: 1, z: 1}
|
||||
- {x: 1, y: 1, z: -1}
|
||||
- {x: -0.5930989, y: -1, z: 3.436201}
|
||||
- {x: 1, y: -1, z: -1}
|
||||
- {x: -2.738532, y: 1, z: -0.19425249}
|
||||
- {x: -1, y: 1, z: -1}
|
||||
- {x: -4.925142, y: -1, z: 2.9896603}
|
||||
- {x: -1, y: -1, z: -1}
|
||||
- {x: 4.5489216, y: 0.48635864, z: -4.4367194}
|
||||
- {x: -0.5307379, y: 0.6763722, z: -7.0993633}
|
||||
- {x: -4.382635, y: 0.14230812, z: -6.836036}
|
||||
- {x: 9.363578, y: 0.6839063, z: -0.627285}
|
||||
- {x: 0.53357506, y: -1.1065986, z: -0.53954697}
|
||||
- {x: -3.9168344, y: -1.1065986, z: -0.1942687}
|
||||
- {x: 7.0004053, y: -1.1065986, z: 1.2227235}
|
||||
- {x: 3.1427042, y: -1.1065986, z: 2.38351}
|
||||
- {x: -1.8079829, y: -1.1065986, z: 2.0856476}
|
||||
- {x: -7.639022, y: -1.1065986, z: -1.7800035}
|
||||
m_Dering: 1
|
||||
--- !u!4 &891640506
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 891640504}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 2.0799425, y: 1.1065986, z: 2.4813514}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 425500981}
|
||||
- {fileID: 891640506}
|
BIN
Assets/Bakery/_tempScene/LightingData.asset
Normal file
BIN
Assets/Bakery/_tempScene/LightingData.asset
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
Assets/BakeryLightmaps/NewSix_371857150_probes.asset
Normal file
BIN
Assets/BakeryLightmaps/NewSix_371857150_probes.asset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
"_showBrushName": false,
|
||||
"_viewList": false,
|
||||
"_showTabsInMultipleRows": false,
|
||||
"_iconSize": 64
|
||||
"_iconSize": 73
|
||||
},
|
||||
"pinManager": {
|
||||
"_profileKeys": [
|
||||
|
BIN
Screenshots/NewSix_Custom..._27.12.2023_00-35-33.png
Normal file
BIN
Screenshots/NewSix_Custom..._27.12.2023_00-35-33.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
Reference in New Issue
Block a user