Commit 5c4ee50c authored by Markus Schlösser's avatar Markus Schlösser
Browse files

Added animation

parent 29c2bd21
fileFormatVersion: 2
guid: dca6a7dd892d2ab47be981eaa19bfc78
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: cc910896d006abf4c9e4e515ee886cb3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Fall End
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
fileFormatVersion: 2
guid: 026a5a3d17da2ec4b878bae9363baa61
guid: 76cb207e376cf694db97704e99b554c5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Player Falling
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 21300000, guid: d3abb615b52b81f40bdb8d27d900442c, type: 3}
- time: 0.041666668
value: {fileID: 21300000, guid: 036b8a560be9afc4dae04adddc112849, type: 3}
- time: 0.083333336
value: {fileID: 21300000, guid: 563a6427214c7ae4e82a8f519b3e3603, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 24
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: d3abb615b52b81f40bdb8d27d900442c, type: 3}
- {fileID: 21300000, guid: 036b8a560be9afc4dae04adddc112849, type: 3}
- {fileID: 21300000, guid: 563a6427214c7ae4e82a8f519b3e3603, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.125
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
fileFormatVersion: 2
guid: 7e273615afd176f44af956295f48638c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Falling
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
fileFormatVersion: 2
guid: 11e9cefc5beac4a4c9d38467107a1067
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Player
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 1107736846892145380}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &1102324280811105498
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Player Falling
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
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: 7400000, guid: 7e273615afd176f44af956295f48638c, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1102 &1102778626377719472
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Player Running
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
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: 7400000, guid: b9550c5e6ce5eb0469ce207f29365258, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &1107736846892145380
AnimatorStateMachine:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102778626377719472}
m_Position: {x: 200, y: 0, z: 0}
- serializedVersion: 1
m_State: {fileID: 1102324280811105498}
m_Position: {x: 235, y: 65, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1102778626377719472}
fileFormatVersion: 2
guid: bf9de4fba3f117547af511ac0ebe17f5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Player Running
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 21300000, guid: dcdb694fac0363248868d1d128ef7f61, type: 3}
- time: 0.04347826
value: {fileID: 21300000, guid: 0250e50c12f44a446af173ee13628206, type: 3}
- time: 0.08695652
value: {fileID: 21300000, guid: 874ed8fe8c048dc49859475bef6af086, type: 3}
- time: 0.13043478
value: {fileID: 21300000, guid: cf6260e69638b134fa37a250b5799133, type: 3}
- time: 0.17391305
value: {fileID: 21300000, guid: df9b58946bedc98479fe3329fda3146f, type: 3}
- time: 0.21739131
value: {fileID: 21300000, guid: 2a2bc2db10390ba48b3c0818c71064d1, type: 3}
- time: 0.26086956
value: {fileID: 21300000, guid: b067d38fea596ef42b206468b6618cb8, type: 3}
- time: 0.3043478
value: {fileID: 21300000, guid: b0e9b13d19652a6449df3cdb7d71a999, type: 3}
- time: 0.34782606
value: {fileID: 21300000, guid: b79836dbb9529de4789339b55f1780ce, type: 3}
- time: 0.3913043
value: {fileID: 21300000, guid: 426a35606ebc8774ba58be0363331f4c, type: 3}
- time: 0.43478256
value: {fileID: 21300000, guid: eeb77bc3223fdb242b898a30e4e980da, type: 3}
- time: 0.47826082
value: {fileID: 21300000, guid: 0e8c3ef332db8894eb3a9a8db4e2b3f3, type: 3}
- time: 0.52173907
value: {fileID: 21300000, guid: 05fe43e115211a14b881a31cfb4c72b5, type: 3}
- time: 0.5652173
value: {fileID: 21300000, guid: 34c3b983dec69634da576ebb95c22878, type: 3}
- time: 0.60869557
value: {fileID: 21300000, guid: cf048a9197055954eb86b1d6f1df246b, type: 3}
- time: 0.6521738
value: {fileID: 21300000, guid: f2cc01eee0c67a44cbca01b092b6d6a1, type: 3}
- time: 0.69565207
value: {fileID: 21300000, guid: 3298ad40836ae014196e13798154a559, type: 3}
- time: 0.7391303
value: {fileID: 21300000, guid: 674653bfe5bf3d746b9d5f7a05587349, type: 3}
- time: 0.78260857
value: {fileID: 21300000, guid: 05b8ef029d8494d44a08f61fa3a91e76, type: 3}
- time: 0.8260868
value: {fileID: 21300000, guid: 68b7b2d58f175d24890ebe2cdc143894, type: 3}
- time: 0.86956507
value: {fileID: 21300000, guid: 6f3af1656670dce4d85624d2f61d6531, type: 3}
- time: 0.9130433
value: {fileID: 21300000, guid: d8dad10df61ea744db4d5240c8be0d72, type: 3}
- time: 0.9565216
value: {fileID: 21300000, guid: cb69250344cb5e440a7f353eb763e650, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 23
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: dcdb694fac0363248868d1d128ef7f61, type: 3}
- {fileID: 21300000, guid: 0250e50c12f44a446af173ee13628206, type: 3}
- {fileID: 21300000, guid: 874ed8fe8c048dc49859475bef6af086, type: 3}
- {fileID: 21300000, guid: cf6260e69638b134fa37a250b5799133, type: 3}
- {fileID: 21300000, guid: df9b58946bedc98479fe3329fda3146f, type: 3}
- {fileID: 21300000, guid: 2a2bc2db10390ba48b3c0818c71064d1, type: 3}
- {fileID: 21300000, guid: b067d38fea596ef42b206468b6618cb8, type: 3}
- {fileID: 21300000, guid: b0e9b13d19652a6449df3cdb7d71a999, type: 3}
- {fileID: 21300000, guid: b79836dbb9529de4789339b55f1780ce, type: 3}
- {fileID: 21300000, guid: 426a35606ebc8774ba58be0363331f4c, type: 3}
- {fileID: 21300000, guid: eeb77bc3223fdb242b898a30e4e980da, type: 3}
- {fileID: 21300000, guid: 0e8c3ef332db8894eb3a9a8db4e2b3f3, type: 3}
- {fileID: 21300000, guid: 05fe43e115211a14b881a31cfb4c72b5, type: 3}
- {fileID: 21300000, guid: 34c3b983dec69634da576ebb95c22878, type: 3}
- {fileID: 21300000, guid: cf048a9197055954eb86b1d6f1df246b, type: 3}
- {fileID: 21300000, guid: f2cc01eee0c67a44cbca01b092b6d6a1, type: 3}
- {fileID: 21300000, guid: 3298ad40836ae014196e13798154a559, type: 3}
- {fileID: 21300000, guid: 674653bfe5bf3d746b9d5f7a05587349, type: 3}
- {fileID: 21300000, guid: 05b8ef029d8494d44a08f61fa3a91e76, type: 3}
- {fileID: 21300000, guid: 68b7b2d58f175d24890ebe2cdc143894, type: 3}
- {fileID: 21300000, guid: 6f3af1656670dce4d85624d2f61d6531, type: 3}
- {fileID: 21300000, guid: d8dad10df61ea744db4d5240c8be0d72, type: 3}
- {fileID: 21300000, guid: cb69250344cb5e440a7f353eb763e650, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.9999998
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
fileFormatVersion: 2
guid: b9550c5e6ce5eb0469ce207f29365258
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -14,7 +14,7 @@ MonoBehaviour:
sprite: {fileID: 21300000, guid: 788213b0d137d4e4b96e99bab374c4b9, type: 3}
rotation: 3
top:
left: 2
left: 1
right: 1
enter: 0
land: 0
......
......@@ -14,11 +14,6 @@ public class PlayerActor : MonoBehaviour {
Right = 1
}
private struct RouteSnapshot {
public Vector3 position;
public Orientation orientation;
}
[SerializeField] private GameObject trackingPoint;
[SerializeField] private Tilemap tilemap;
......@@ -27,7 +22,9 @@ public class PlayerActor : MonoBehaviour {
[SerializeField] private MovementDirection facing = MovementDirection.Right;
[SerializeField] public InputProvider inputProvider;
[SerializeField] private InputProvider inputProvider;
[SerializeField] private Animator animator;
private void Start() {
Cinemachine.CinemachineVirtualCamera cam = Camera.main.GetComponent<Cinemachine.CinemachineVirtualCamera>();
......@@ -35,6 +32,8 @@ public class PlayerActor : MonoBehaviour {
if (cam != null) {
cam.Follow = trackingPoint.transform;
}
//Time.timeScale = 0.1f;
}
private void Update() {
......@@ -60,14 +59,27 @@ public class PlayerActor : MonoBehaviour {
}
private void UpdateOrientation() {
transform.rotation = GetRotation(orientation, facing);
}
private static Quaternion GetRotation(Orientation orientation, MovementDirection facing) {
Vector3 euler = new Vector3(0, 0, (int) orientation * -90.0f);
if (orientation == Orientation.Left || orientation == Orientation.Right) {
euler.x = facing == MovementDirection.Right ? 0 : 180.0f;
} else if (orientation == Orientation.Up || orientation == Orientation.Down) {
euler.y = facing == MovementDirection.Right ? 0 : 180.0f;
switch (orientation) {
case Orientation.Left:
case Orientation.Right:
euler.x = facing == MovementDirection.Right ? 0 : 180.0f;
break;
case Orientation.Up:
case Orientation.Down:
euler.y = facing == MovementDirection.Right ? 0 : 180.0f;
break;
default:
throw new ArgumentOutOfRangeException();
}
transform.rotation = Quaternion.Euler(euler);
return Quaternion.Euler(euler);
}
private Vector3Int GetDirectionVector(Orientation o) {
......@@ -84,15 +96,17 @@ public class PlayerActor : MonoBehaviour {
private IEnumerator Move(MovementDirection direction) {
isMoving = true;
List<RouteSnapshot> route = new List<RouteSnapshot>();
List<IEnumerator> route = new List<IEnumerator>();
Orientation o = orientation;
Vector3Int celllPos = tilemap.WorldToCell(transform.position);
Vector3Int cellPos = tilemap.WorldToCell(transform.position);
bool isCompleteRoute = false;
bool isValidRoute = true;
int numSteps = 0;
route.Add(Move(o.RotateClockwise((int) direction), 0.5f, 0.125f));
while (!isCompleteRoute && isValidRoute) {
if (numSteps++ > MAX_STEPS) {
isValidRoute = false;
......@@ -105,21 +119,21 @@ public class PlayerActor : MonoBehaviour {
Orientation enterFace = directionOrientation.GetDown();
Vector3Int adjacentCellPos = celllPos + directionVec;
Vector3Int adjacentCellPos = cellPos + directionVec;
Vector3Int adjacentDownCellPos = adjacentCellPos + downVec;
RotatedTile adjacentTile = tilemap.GetTile<RotatedTile>(adjacentCellPos);
RotatedTile adjacentDownTile = tilemap.GetTile<RotatedTile>(adjacentDownCellPos);
Debug.DrawLine(tilemap.GetCellCenterWorld(celllPos), tilemap.GetCellCenterWorld(adjacentCellPos), adjacentTile == null ? Color.red : Color.green);
Debug.DrawLine(tilemap.GetCellCenterWorld(celllPos), tilemap.GetCellCenterWorld(adjacentDownCellPos), adjacentDownTile == null ? Color.red : Color.green);
Debug.DrawLine(tilemap.GetCellCenterWorld(cellPos), tilemap.GetCellCenterWorld(adjacentCellPos), adjacentTile == null ? Color.red : Color.green);
Debug.DrawLine(tilemap.GetCellCenterWorld(cellPos), tilemap.GetCellCenterWorld(adjacentDownCellPos), adjacentDownTile == null ? Color.red : Color.green);
if (adjacentTile != null) {
cellPos += directionVec;