Skip to content

Commit

Permalink
ExoFab: Feed animation
Browse files Browse the repository at this point in the history
  • Loading branch information
TBartl committed Oct 7, 2018
1 parent 8624200 commit db6cdbb
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@
using UnityEngine;

public class ExoFabFeedEntry : Interactable {
[SerializeField] Transform insertPoint;
[SerializeField] AnimationCurve curve = AnimationCurve.EaseInOut(0, 0, 1, 1);
static float feedTime = .5f;
public override bool GetInteractable(Interactor interactor) {
return base.GetInteractable(interactor); ;
}

public override void InteractWith(Interactor interactor) {
StartCoroutine(Feed(interactor));
}

IEnumerator Feed(Interactor interactor) {
Vector3 fromPos = interactor.transform.position;
Quaternion fromRot = interactor.transform.rotation;
Destroy(interactor.GetComponent<Rigidbody>());
for (float t = 0; t < feedTime; t += Time.deltaTime) {
float p = t / feedTime;
p = curve.Evaluate(p);
interactor.transform.position = Vector3.Lerp(fromPos, insertPoint.transform.position, p);
interactor.transform.rotation = Quaternion.Slerp(fromRot, insertPoint.transform.rotation, p);
yield return null;
}
Destroy(interactor.gameObject);
}
}
58 changes: 57 additions & 1 deletion SS5R-Source/Assets/Prefabs/Environment/ExosuitFabricator.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,36 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1 &1943860305721998956
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8461922189458023290}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8461922189458023290
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1943860305721998956}
m_LocalRotation: {x: -0.4999999, y: 0.49999994, z: -0.4999986, w: 0.50000155}
m_LocalPosition: {x: 0.384, y: 0.605, z: 0.222}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5000033351776347562}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 90.00001, z: -90.00001}
--- !u!1 &2477247611158952503
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -660,7 +690,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 8461922189458023290}
m_Father: {fileID: 6805438807763791515}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -763,6 +794,31 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b4c84acd4257821488bd7af6f20d6478, type: 3}
m_Name:
m_EditorClassIdentifier:
insertPoint: {fileID: 8461922189458023290}
curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &4499339492433889285
GameObject:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit db6cdbb

Please sign in to comment.