working on ai still
This commit is contained in:
@@ -68,8 +68,6 @@ namespace RebootReality.jelycho.Enemies {
|
||||
return BehaviourNode.Status.Failure;
|
||||
}
|
||||
|
||||
Debug.Log("Picking victim");
|
||||
|
||||
Actor victim = zombie.FindNewVictim();
|
||||
if (victim == null) {
|
||||
return BehaviourNode.Status.Failure;
|
||||
@@ -85,8 +83,6 @@ namespace RebootReality.jelycho.Enemies {
|
||||
return BehaviourNode.Status.Failure;
|
||||
}
|
||||
|
||||
Debug.Log("Goto player");
|
||||
|
||||
if (!zombie.HasTravelDestination) {
|
||||
float3 victimPos = zombie.Victim.transform.position;
|
||||
float dstToVictimSq = math.distancesq(victimPos, zombie.transform.position);
|
||||
@@ -131,6 +127,11 @@ namespace RebootReality.jelycho.Enemies {
|
||||
[SerializeField, Group("Body parts")] ZombieBodyPart m_LeftLeg;
|
||||
[SerializeField, Group("Body parts")] ZombieBodyPart m_RightLeg;
|
||||
|
||||
[SerializeField, Group("Animations")] TransitionAsset m_GroundLocomotion;
|
||||
[SerializeField, Group("Animations")] StringAsset m_GroundLocomotionPropertyRight;
|
||||
[SerializeField, Group("Animations")] StringAsset m_GroundLocomotionPropertyForward;
|
||||
SmoothedVector2Parameter m_SmoothLocomotionDirection;
|
||||
|
||||
[SerializeField, Group("Animations")] AnimationClip[] m_AttackClips;
|
||||
|
||||
BehaviourTree m_BehaviourTree;
|
||||
@@ -155,6 +156,12 @@ namespace RebootReality.jelycho.Enemies {
|
||||
void Awake() {
|
||||
SetRagdollLocal(IsRagdoll);
|
||||
|
||||
m_SmoothLocomotionDirection = new SmoothedVector2Parameter(m_Animancer,
|
||||
m_GroundLocomotionPropertyRight,
|
||||
m_GroundLocomotionPropertyForward,
|
||||
0.1f);
|
||||
m_Animancer.Play(m_GroundLocomotion);
|
||||
|
||||
m_BehaviourTree = new BehaviourTree("Zombie Behaviour");
|
||||
|
||||
var rootSelector = new Selector("Root");
|
||||
@@ -186,8 +193,11 @@ namespace RebootReality.jelycho.Enemies {
|
||||
return;
|
||||
}
|
||||
|
||||
float velXZ = m_NavAgent.velocity.With(y: 0).magnitude;
|
||||
// m_Animator.SetFloat(s_MovementSpeedHash, velXZ);
|
||||
float3 vel = m_NavAgent.velocity;
|
||||
float forwardVelocity = math.dot(m_NavAgent.transform.forward, vel);
|
||||
float rightVelocity = math.dot(m_NavAgent.transform.right, vel);
|
||||
|
||||
m_SmoothLocomotionDirection.TargetValue = new Vector2(rightVelocity, forwardVelocity);
|
||||
}
|
||||
|
||||
public override void OnServerTick(float deltaTime) {
|
||||
@@ -203,6 +213,7 @@ namespace RebootReality.jelycho.Enemies {
|
||||
|
||||
if (math.distancesq(pos, TravelDestination) <= 1.0f) {
|
||||
HasTravelDestination = false;
|
||||
m_NavAgent.isStopped = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +231,7 @@ namespace RebootReality.jelycho.Enemies {
|
||||
|
||||
TravelDestination = pos;
|
||||
HasTravelDestination = true;
|
||||
m_NavAgent.isStopped = false;
|
||||
return m_NavAgent.SetDestination(TravelDestination);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aadf824e76564404c8d43d99803c60a1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -656,12 +656,13 @@ namespace RebootReality.jelycho.Player {
|
||||
m_CurrentCameraBobbing = Mathf.MoveTowards(m_CurrentCameraBobbing,
|
||||
m_TargetCameraBobbing,
|
||||
m_CameraBobbingTransitionSpeed * deltaTime);
|
||||
m_Camera.SetBobbing(m_CurrentCameraBobbing);
|
||||
//m_Camera.SetBobbing(m_CurrentCameraBobbing);
|
||||
|
||||
m_CameraSpring.UpdateSpring(deltaTime,
|
||||
m_CharacterForwardTransform.up,
|
||||
m_CharacterForwardTransform.right,
|
||||
m_CharacterForwardTransform.forward);
|
||||
m_Camera.SetBobbing(0.0f);
|
||||
// m_CameraSpring.UpdateSpring(deltaTime,
|
||||
// m_CharacterForwardTransform.up,
|
||||
// m_CharacterForwardTransform.right,
|
||||
// m_CharacterForwardTransform.forward);
|
||||
}
|
||||
|
||||
void SenseInteractable() {
|
||||
@@ -845,7 +846,6 @@ namespace RebootReality.jelycho.Player {
|
||||
float3 targetCharacterForward = math.normalize(LookDirection.With(y: 0.0f));
|
||||
float3 currentCharacterForward = math.normalize(m_CharacterForwardTransform.forward.With(y: 0.0f));
|
||||
|
||||
// float angleDeg = Mathf.DeltaAngle(m_Camera.Yaw, m_Locomotion.YawRotation);
|
||||
float angleRad = math.acos(math.clamp(math.dot(targetCharacterForward, currentCharacterForward) / (math.length(targetCharacterForward) * math.length(currentCharacterForward)), -1f, 1f));
|
||||
float angleDeg = math.degrees(angleRad);
|
||||
|
||||
@@ -881,6 +881,7 @@ namespace RebootReality.jelycho.Player {
|
||||
}
|
||||
|
||||
// Aim Target adjustment
|
||||
// @BUG: when humbie interacts with a player then a camera is shaking
|
||||
m_HeadAimTargetTransform.position = (float3) m_HeadBoneTransform.position + LookDirection * 5.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user