Compare commits

..

No commits in common. "288678f3b56760d3d4177d712631984f7be66a60" and "0aabeff96e0d4f4ed82f0bbb344c02ea6990a272" have entirely different histories.

5 changed files with 4263 additions and 2347 deletions

View File

@ -10,9 +10,6 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 2715764554523923620} - component: {fileID: 2715764554523923620}
- component: {fileID: 3650884189301972455} - component: {fileID: 3650884189301972455}
- component: {fileID: 7372041109052800040}
- component: {fileID: 7759656673043564915}
- component: {fileID: 2818254731145199880}
m_Layer: 0 m_Layer: 0
m_Name: GameManager m_Name: GameManager
m_TagString: Untagged m_TagString: Untagged
@ -47,151 +44,3 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4c31bfd8f0f10f540b73de81aac6d46c, type: 3} m_Script: {fileID: 11500000, guid: 4c31bfd8f0f10f540b73de81aac6d46c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_difficulty: 1
NeedFullfilledParticleEffect: {fileID: 1620116211597326, guid: 094c049ae10f1c3419c96c4bce41cf8c, type: 3}
ZombieDeathByDisableParticleEffect: {fileID: 0}
Needs: []
_player: {fileID: 0}
_totalGameDurationSeconds: 0
_remainingGameDurationSeconds: 0
_currentEfficiency: 0
_generalNeedDrainScaling: 0.001
_developers:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
_gameRunning:
_falseness: 1
_needNotificationThreshold: 0.25
_maxContextBufferSize: 3
--- !u!114 &7372041109052800040
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2703668081068178613}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c18f377723b64fd8a8d0261b85b3ba48, type: 3}
m_Name:
m_EditorClassIdentifier:
_daysUntilRelease: 7
_secondsPerDay: 120
_totalTime: 0
_sun: {fileID: 0}
--- !u!114 &7759656673043564915
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2703668081068178613}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8f523547bf5e54c4989863475e2bdbaf, type: 3}
m_Name:
m_EditorClassIdentifier:
_ambientMusic:
- {fileID: 8300000, guid: 680bb3ce77c09334998b4c94313049d0, type: 3}
- {fileID: 8300000, guid: 71646a2bfa6761d47ace4395791decfe, type: 3}
- {fileID: 8300000, guid: 95f03e199fce21c4c92959821c685f3d, type: 3}
_showDownMusic: {fileID: 8300000, guid: 608315f6bbecbd94e8e3bc4e16f7a429, type: 3}
_musicTimer: 5
--- !u!82 &2818254731145199880
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2703668081068178613}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 0.3
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 32
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@ -92,8 +92,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856601670117699726} m_GameObject: {fileID: 856601670117699726}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000016292068}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: -3.86, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -138,16 +138,12 @@ MonoBehaviour:
- {fileID: 8300000, guid: 866ac9f78eeaf514aa666667753ff280, type: 3} - {fileID: 8300000, guid: 866ac9f78eeaf514aa666667753ff280, type: 3}
- {fileID: 8300000, guid: daa3c8aa3194de542ab4aa911886644b, type: 3} - {fileID: 8300000, guid: daa3c8aa3194de542ab4aa911886644b, type: 3}
- {fileID: 8300000, guid: 559ec60d7a147d14dbbfc776266dad5e, type: 3} - {fileID: 8300000, guid: 559ec60d7a147d14dbbfc776266dad5e, type: 3}
_speed: 0.5 _speed: 0.3
_rotateSpeed: 270 _rotateSpeed: 180
_attackRange: 1.5 _attackRange: 0.8
_jumpForce: 6 _idleThresholdFactor: 0.12
_idleThresholdFactor: 3
_noiseDelay: 4 _noiseDelay: 4
_noiseTimer: 0 _noiseTimer: 0
_groundLayer:
serializedVersion: 2
m_Bits: 8
--- !u!54 &7592819367808213806 --- !u!54 &7592819367808213806
Rigidbody: Rigidbody:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -156,8 +152,8 @@ Rigidbody:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856601670117699726} m_GameObject: {fileID: 856601670117699726}
serializedVersion: 4 serializedVersion: 4
m_Mass: 30 m_Mass: 1
m_Drag: 1 m_Drag: 0
m_AngularDrag: 0.05 m_AngularDrag: 0.05
m_CenterOfMass: {x: 0, y: 0, z: 0} m_CenterOfMass: {x: 0, y: 0, z: 0}
m_InertiaTensor: {x: 1, y: 1, z: 1} m_InertiaTensor: {x: 1, y: 1, z: 1}
@ -170,7 +166,7 @@ Rigidbody:
m_Bits: 0 m_Bits: 0
m_ImplicitCom: 1 m_ImplicitCom: 1
m_ImplicitTensor: 1 m_ImplicitTensor: 1
m_UseGravity: 1 m_UseGravity: 0
m_IsKinematic: 0 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 80 m_Constraints: 80
@ -210,13 +206,13 @@ AudioSource:
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0} m_audioClip: {fileID: 0}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 0.5 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
Loop: 0 Loop: 0
Mute: 0 Mute: 0
Spatialize: 0 Spatialize: 0
SpatializePostEffects: 0 SpatializePostEffects: 0
Priority: 69 Priority: 128
DopplerLevel: 1 DopplerLevel: 1
MinDistance: 1 MinDistance: 1
MaxDistance: 500 MaxDistance: 500

View File

@ -12,7 +12,6 @@ AnimatorState:
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: m_Transitions:
- {fileID: -2499677071233001700} - {fileID: -2499677071233001700}
- {fileID: -6471167266255213614}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0} m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0 m_IKOnFeet: 0
@ -78,31 +77,6 @@ AnimatorStateMachine:
m_ExitPosition: {x: 110, y: 510, z: 0} m_ExitPosition: {x: 110, y: 510, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 3345498408644874919} m_DefaultState: {fileID: 3345498408644874919}
--- !u!1101 &-6471167266255213614
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4338890450920113477}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25000003
m_TransitionOffset: 0
m_ExitTime: 0.019070633
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-4935679139000002796 --- !u!1101 &-4935679139000002796
AnimatorStateTransition: AnimatorStateTransition:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -163,6 +137,9 @@ AnimatorStateTransition:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: m_Name:
m_Conditions: m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: Attack
m_EventTreshold: 0
- m_ConditionMode: 1 - m_ConditionMode: 1
m_ConditionEvent: Idle m_ConditionEvent: Idle
m_EventTreshold: 0 m_EventTreshold: 0
@ -197,19 +174,19 @@ AnimatorController:
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
- m_Name: Idle - m_Name: Idle
m_Type: 4 m_Type: 4
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 1 m_DefaultBool: 1
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
- m_Name: Attack - m_Name: Attack
m_Type: 4 m_Type: 4
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 0}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer

File diff suppressed because it is too large Load Diff

View File

@ -20,15 +20,11 @@ public class Zombie : MonoBehaviour
[SerializeField] [SerializeField]
private float _attackRange = 1.3f; private float _attackRange = 1.3f;
[SerializeField] [SerializeField]
private float _jumpForce;
[SerializeField]
private float _idleThresholdFactor = 0.2f; private float _idleThresholdFactor = 0.2f;
[SerializeField] [SerializeField]
private float _noiseDelay = 5.0f; private float _noiseDelay = 5.0f;
[SerializeField, ShowOnly] [SerializeField, ShowOnly]
private float _noiseTimer; private float _noiseTimer;
[SerializeField]
private LayerMask _groundLayer;
private Rigidbody _rb; private Rigidbody _rb;
private AudioSource _audioSource; private AudioSource _audioSource;
@ -36,7 +32,7 @@ public class Zombie : MonoBehaviour
private Animator _animator; private Animator _animator;
private bool _isAttacking = false; private bool _isAttacking = false;
private float _idleThreshold; private float _idleThreshold;
private Vector3 _initialPosition; private Quaternion _initialRotation;
@ -53,7 +49,7 @@ public class Zombie : MonoBehaviour
_audioSource = GetComponent<AudioSource>(); _audioSource = GetComponent<AudioSource>();
_animator = GetComponent<Animator>(); _animator = GetComponent<Animator>();
_idleThreshold = _speed / _idleThresholdFactor; _idleThreshold = _speed / _idleThresholdFactor;
_initialPosition = transform.position; _initialRotation = transform.rotation;
} }
void Update() void Update()
@ -71,9 +67,8 @@ void Update()
{ {
Vector3 direction = (GameManager.Instance.Player.transform.position - transform.position); Vector3 direction = (GameManager.Instance.Player.transform.position - transform.position);
Quaternion goalRotation = Quaternion.LookRotation(direction); Quaternion goalRotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.Euler(0, Quaternion.RotateTowards(transform.rotation, goalRotation, _rotateSpeed * Time.deltaTime).eulerAngles.y, 0); transform.rotation = Quaternion.RotateTowards(transform.rotation, goalRotation, _rotateSpeed * Time.deltaTime);
float diff = direction.magnitude; float diff = direction.magnitude;
//Debug.Log(diff);
if (diff <= _attackRange && !_isAttacking) if (diff <= _attackRange && !_isAttacking)
{ {
_animator.SetFloat("Running", 0); _animator.SetFloat("Running", 0);
@ -83,21 +78,12 @@ void Update()
else else
{ {
Vector3 oldPosition = _rb.position; Vector3 oldPosition = _rb.position;
Vector3 goalDirection = new Vector3(direction.x, 0.2f, direction.z); _rb.MovePosition(_rb.position + direction * _speed * Time.deltaTime);
if (Physics.Raycast(transform.position + new Vector3(0, 0.1f, 0), goalDirection, 1f, _groundLayer))
{
Debug.Log("RayCast HIT");
//_rb.AddForce(Vector3.up * _jumpForce, ForceMode.Impulse);
_rb.MovePosition(_rb.position - transform.forward * Time.deltaTime);
_rb.MovePosition(_rb.position + new Vector3(0, _jumpForce, 0) * Time.deltaTime);
}
_rb.MovePosition(_rb.position + goalDirection * _speed * Time.deltaTime);
float dist = Vector3.Distance(oldPosition, _rb.position); float dist = Vector3.Distance(oldPosition, _rb.position);
//Debug.Log($"Distance: {dist}, Threshold: {_idleThreshold * Time.deltaTime}");
if (dist > _idleThreshold * Time.deltaTime) if (dist > _idleThreshold * Time.deltaTime)
{ {
_animator.SetBool("Idle", false); _animator.SetBool("Idle", false);
_animator.SetFloat("Running", _speed * 3.0f); _animator.SetFloat("Running", 1);
} }
else else
{ {
@ -111,12 +97,12 @@ void Update()
{ {
_isAttacking = true; _isAttacking = true;
_animator.SetBool("Attack", true); _animator.SetBool("Attack", true);
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(1.5f);
_animator.SetBool("Attack", false); _animator.SetBool("Attack", false);
// check if actually hit // check if actually hit
Vector3 direction = (GameManager.Instance.Player.transform.position - transform.position); Vector3 direction = (GameManager.Instance.Player.transform.position - transform.position);
float diff = direction.magnitude; float diff = direction.magnitude;
if (diff <= _attackRange + 0.6f) if (diff <= _attackRange + 0.5f)
{ {
GameManager.Instance.Player.GetComponent<Character>().PickupItem(null); GameManager.Instance.Player.GetComponent<Character>().PickupItem(null);
} }