Shiny shiny golem animations + attack

This commit is contained in:
Crizomb 2025-01-16 01:48:50 +01:00
parent c74ebe3225
commit ffb1f1caa1
14 changed files with 169 additions and 38 deletions

View file

@ -41,19 +41,19 @@ ModelImporter:
extraUserProperties: [] extraUserProperties: []
clipAnimations: clipAnimations:
- serializedVersion: 16 - serializedVersion: 16
name: irongolem_skeleton|walk (1) name: irongolem_skeleton|attack
takeName: irongolem_skeleton|walk takeName: irongolem_skeleton|attack
internalID: -8210521561905758688 internalID: -8210521561905758688
firstFrame: 0 firstFrame: 0
lastFrame: 42 lastFrame: 40
wrapMode: 0 wrapMode: 0
orientationOffsetY: 0 orientationOffsetY: 0
level: 0 level: 0
cycleOffset: 0 cycleOffset: 0
loop: 0 loop: 0
hasAdditiveReferencePose: 0 hasAdditiveReferencePose: 0
loopTime: 1 loopTime: 0
loopBlend: 1 loopBlend: 0
loopBlendOrientation: 0 loopBlendOrientation: 0
loopBlendPositionY: 0 loopBlendPositionY: 0
loopBlendPositionXZ: 0 loopBlendPositionXZ: 0
@ -162,7 +162,7 @@ ModelImporter:
- serializedVersion: 16 - serializedVersion: 16
name: irongolem_skeleton|walk name: irongolem_skeleton|walk
takeName: irongolem_skeleton|walk takeName: irongolem_skeleton|walk
internalID: 223874217054986128 internalID: -1770885586292802368
firstFrame: 0 firstFrame: 0
lastFrame: 42 lastFrame: 42
wrapMode: 0 wrapMode: 0
@ -171,8 +171,8 @@ ModelImporter:
cycleOffset: 0 cycleOffset: 0
loop: 0 loop: 0
hasAdditiveReferencePose: 0 hasAdditiveReferencePose: 0
loopTime: 0 loopTime: 1
loopBlend: 0 loopBlend: 1
loopBlendOrientation: 0 loopBlendOrientation: 0
loopBlendPositionY: 0 loopBlendPositionY: 0
loopBlendPositionXZ: 0 loopBlendPositionXZ: 0

View file

@ -1,16 +1,17 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1102 &-2777464731564468502 --- !u!1102 &-2750152826211295247
AnimatorState: AnimatorState:
serializedVersion: 6 serializedVersion: 6
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: irongolem_skeleton|walk (1) m_Name: irongolem_skeleton|attack
m_Speed: 1 m_Speed: 1
m_CycleOffset: 0 m_CycleOffset: 0
m_Transitions: [] m_Transitions:
- {fileID: 6672038223336554071}
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
@ -34,7 +35,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: IronGolemAnim m_Name: IronGolemAnim
serializedVersion: 5 serializedVersion: 5
m_AnimatorParameters: [] m_AnimatorParameters:
- m_Name: Attack
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer
@ -48,6 +55,33 @@ AnimatorController:
m_IKPass: 0 m_IKPass: 0
m_SyncedLayerAffectsTiming: 0 m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000} m_Controller: {fileID: 9100000}
--- !u!1102 &1107932986916078502
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: irongolem_skeleton|walk
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 3013542025257400080}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -1770885586292802368, guid: c75e2207961576059b7aecc6e661e516, type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &2949891407108289545 --- !u!1107 &2949891407108289545
AnimatorStateMachine: AnimatorStateMachine:
serializedVersion: 6 serializedVersion: 6
@ -58,15 +92,65 @@ AnimatorStateMachine:
m_Name: Base Layer m_Name: Base Layer
m_ChildStates: m_ChildStates:
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -2777464731564468502} m_State: {fileID: 1107932986916078502}
m_Position: {x: 383, y: 237, z: 0} m_Position: {x: 100, y: 60, z: 0}
- serializedVersion: 1
m_State: {fileID: -2750152826211295247}
m_Position: {x: 100, y: 190, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []
m_StateMachineTransitions: {} m_StateMachineTransitions: {}
m_StateMachineBehaviours: [] m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0} m_AnyStatePosition: {x: 490, y: -140, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0} m_EntryPosition: {x: 120, y: -90, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: -2777464731564468502} m_DefaultState: {fileID: 1107932986916078502}
--- !u!1101 &3013542025257400080
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: -2750152826211295247}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &6672038223336554071
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1107932986916078502}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.85
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1

View file

@ -10,7 +10,7 @@ PrefabInstance:
m_Modifications: m_Modifications:
- target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Height propertyPath: m_Height
value: 4 value: 3.6
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Radius propertyPath: m_Radius
@ -28,6 +28,10 @@ PrefabInstance:
propertyPath: m_Enabled propertyPath: m_Enabled
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2572766376840025726, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: <Animator>k__BackingField
value:
objectReference: {fileID: 2861011447331939094}
- target: {fileID: 3092074377783379531, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 3092074377783379531, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0 value: 0
@ -68,13 +72,17 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_LocalScale.x
value: 1.8190169
objectReference: {fileID: 0}
- target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
value: 1.7602 value: 1.7602
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_LocalScale.z propertyPath: m_LocalScale.z
value: 1.2260123 value: 1.4614067
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 3230378027333185902, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@ -104,6 +112,10 @@ PrefabInstance:
propertyPath: m_AgentTypeID propertyPath: m_AgentTypeID
value: -1372625422 value: -1372625422
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6587310683195830629, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: knockbackTime
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8213395333053285225, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 8213395333053285225, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: maxHealth propertyPath: maxHealth
value: 200 value: 200

View file

@ -24,13 +24,13 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 917273970599158663} m_GameObject: {fileID: 917273970599158663}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: -0.22837688, y: -0, z: -0, w: 0.97357285} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.63, z: 1.147} m_LocalPosition: {x: 0, y: 1.341, z: -0.059}
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: []
m_Father: {fileID: 7591572713894325371} m_Father: {fileID: 7591572713894325371}
m_LocalEulerAnglesHint: {x: -26.403, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1016193982292097397 --- !u!1 &1016193982292097397
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -71,6 +71,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Height
value: 1.9
objectReference: {fileID: 0}
- target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Enabled propertyPath: m_Enabled
value: 1 value: 1
@ -131,6 +135,10 @@ PrefabInstance:
propertyPath: m_Speed propertyPath: m_Speed
value: 2 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 6587310683195830629, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: speed
value: 3
objectReference: {fileID: 0}
- target: {fileID: 8908285060348773052, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 8908285060348773052, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: attackShape propertyPath: attackShape
value: value:

View file

@ -8,6 +8,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1085507300097694875, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Height
value: 1.9
objectReference: {fileID: 0}
- target: {fileID: 2076979688870881298, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3} - target: {fileID: 2076979688870881298, guid: 8094e6afe32f290e6987d6a2fc43119d, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: BaseZombie value: BaseZombie

View file

@ -12,6 +12,10 @@ PrefabInstance:
propertyPath: cooldown propertyPath: cooldown
value: 4 value: 4
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 694975301204954681, guid: 31f097ed795257d8da1f9b48164def89, type: 3}
propertyPath: directShot
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3646442495847485308, guid: 31f097ed795257d8da1f9b48164def89, type: 3} - target: {fileID: 3646442495847485308, guid: 31f097ed795257d8da1f9b48164def89, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:

View file

@ -12,6 +12,10 @@ PrefabInstance:
propertyPath: cooldown propertyPath: cooldown
value: 4 value: 4
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 694975301204954681, guid: 31f097ed795257d8da1f9b48164def89, type: 3}
propertyPath: directShot
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3646442495847485308, guid: 31f097ed795257d8da1f9b48164def89, type: 3} - target: {fileID: 3646442495847485308, guid: 31f097ed795257d8da1f9b48164def89, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:

View file

@ -10774,7 +10774,7 @@ Transform:
m_GameObject: {fileID: 985930954} m_GameObject: {fileID: 985930954}
serializedVersion: 2 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: 3.64953, y: 6.124237, z: 69.593155} m_LocalPosition: {x: -44.14, y: 6.124237, z: 69.593155}
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:
@ -15554,7 +15554,7 @@ Transform:
m_GameObject: {fileID: 1448926685} m_GameObject: {fileID: 1448926685}
serializedVersion: 2 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: -27.374645, y: -20.604273, z: 60.15} m_LocalPosition: {x: -27.374645, y: -20.604273, z: 20.94}
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:
@ -20290,8 +20290,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1908715244} m_GameObject: {fileID: 1908715244}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: -0, y: -0.698484, z: -0, w: 0.71562576}
m_LocalPosition: {x: -22.7, y: -8.150209, z: 35.386692} m_LocalPosition: {x: 5.3058853, y: -8.150209, z: 62.397087}
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:
@ -20299,7 +20299,7 @@ Transform:
- {fileID: 269824241} - {fileID: 269824241}
- {fileID: 1339550851} - {fileID: 1339550851}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: -88.611, z: 0}
--- !u!1001 &1914717308 --- !u!1001 &1914717308
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -7,7 +7,7 @@ public enum DeathSate
QueenBDead = 2, QueenBDead = 2,
} }
// For compatibility with the other team units, only contains things that need to be in common
public abstract class AbstractUnit : MonoBehaviour public abstract class AbstractUnit : MonoBehaviour
{ {
public float price; public float price;

View file

@ -17,6 +17,12 @@ public class ArrowHandler : MonoBehaviour
_rigidBody = GetComponent<Rigidbody>(); _rigidBody = GetComponent<Rigidbody>();
} }
void Start()
{
// Destroy after 8s, in all case
Destroy(this.gameObject, 8.0f);
}
void Update() void Update()
{ {
// Align with speed // Align with speed

View file

@ -56,6 +56,14 @@ public class AttackHandler : MonoBehaviour
MinecraftUnit minecraftTarget = (MinecraftUnit)targetUnit; MinecraftUnit minecraftTarget = (MinecraftUnit)targetUnit;
minecraftTarget.StartCoroutine(minecraftTarget.MovementHandler.TakeImpulse(knockbackVector)); minecraftTarget.StartCoroutine(minecraftTarget.MovementHandler.TakeImpulse(knockbackVector));
} }
// Attack animation
if (_minecraftUnit.Animator)
{
_minecraftUnit.Animator.SetTrigger("Attack");
}
} }
return true; return true;
} }

View file

@ -13,6 +13,6 @@ public class NeutralBehaviour : AbstractBehaviour
protected override void AttackAction() protected override void AttackAction()
{ {
Unit.AttackHandler.Attack(); //Unit.AttackHandler.Attack();
} }
} }

View file

@ -1,24 +1,26 @@
using System.Runtime.CompilerServices;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
[DisallowMultipleComponent] [DisallowMultipleComponent]
[RequireComponent(typeof(Rigidbody))] [RequireComponent(typeof(Rigidbody), typeof(HealthHandler), typeof(AttackHandler))]
[RequireComponent(typeof(MovementHandler))]
public class MinecraftUnit : AbstractUnit public class MinecraftUnit : AbstractUnit
{ {
[field: SerializeField] public Rigidbody Body { get; private set; } [field: SerializeField] public Rigidbody Body { get; private set; }
[field: SerializeField] public HealthHandler HealthHandler { get; private set; } [field: SerializeField] public HealthHandler HealthHandler { get; private set; }
[field: SerializeField] public AttackHandler AttackHandler { get; private set; } [field: SerializeField] public AttackHandler AttackHandler { get; private set; }
[field: SerializeField] public MovementHandler MovementHandler { get; private set; } [field: SerializeField] public MovementHandler MovementHandler { get; private set; }
// Not required
[field: SerializeField] public Animator Animator { get; private set; }
void OnValidate() void OnValidate()
{ {
Debug.Assert(Body != null);
Debug.Assert(HealthHandler != null);
Debug.Assert(AttackHandler != null);
Debug.Assert(MovementHandler != null);
} }
// Abstract implementation for compatibility with other team // Abstract implementation for compatibility with other team

View file

@ -12,9 +12,8 @@ public class MovementHandler : MonoBehaviour
[SerializeField] public float speed; [SerializeField] public float speed;
[SerializeField] private NavMeshAgent agent; [SerializeField] private NavMeshAgent agent;
[SerializeField] private Transform defaultMoveTarget; [SerializeField] private Transform defaultMoveTarget;
[SerializeField] private float knockbackTime = 1.2f;
private float knockbackTime = 1.2f; private float _noNavMeshDeadTime = 6.0f;
private float noNavMeshDeadTime = 6.0f;
[HideInInspector] public AbstractUnit TargetUnit {get; private set; } [HideInInspector] public AbstractUnit TargetUnit {get; private set; }
@ -103,7 +102,7 @@ public class MovementHandler : MonoBehaviour
noSurfaceTime += 0.5f; noSurfaceTime += 0.5f;
// Die if exited navMesh for to long // Die if exited navMesh for to long
if (noSurfaceTime > noNavMeshDeadTime) if (noSurfaceTime > _noNavMeshDeadTime)
{ {
_minecraftUnit.HealthHandler.Death(); _minecraftUnit.HealthHandler.Death();
yield break; yield break;