Browse Source

Merge branch 'develop' of https://git.joshuareason.com/Jam/GGJ_2021 into develop

develop
Ellie 3 years ago
parent
commit
cc5e8697bc
5 changed files with 36 additions and 3 deletions
  1. +14
    -1
      Assets/Baby.prefab
  2. +10
    -2
      Assets/Scripts/BabyController.cs
  3. +4
    -0
      Assets/Scripts/Behaviours/YeetController.cs
  4. +3
    -0
      Assets/Scripts/Behaviours/YeetHandle.cs
  5. +5
    -0
      Assets/Scripts/LookAtCamera.cs

+ 14
- 1
Assets/Baby.prefab View File

@ -107,7 +107,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1559629916365419313} m_GameObject: {fileID: 1559629916365419313}
m_LocalRotation: {x: -0.000000016727624, y: 0.92387956, z: 0.38268343, w: -0.00000004038406}
m_LocalRotation: {x: 0.1308854, y: 0.8681629, z: 0.31598538, w: -0.35960484}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: m_Children:
@ -419,6 +419,7 @@ GameObject:
- component: {fileID: 2698261171203200709} - component: {fileID: 2698261171203200709}
- component: {fileID: 8095308533274768900} - component: {fileID: 8095308533274768900}
- component: {fileID: 3309192074068051052} - component: {fileID: 3309192074068051052}
- component: {fileID: 933390416532010}
m_Layer: 0 m_Layer: 0
m_Name: Baby m_Name: Baby
m_TagString: Untagged m_TagString: Untagged
@ -538,6 +539,18 @@ MonoBehaviour:
faceObj: {fileID: 1577162025261597670} faceObj: {fileID: 1577162025261597670}
topObj: {fileID: 6588930193113420027} topObj: {fileID: 6588930193113420027}
bottomObj: {fileID: 4834944236669872262} bottomObj: {fileID: 4834944236669872262}
--- !u!114 &933390416532010
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6037890115969564912}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a18fca169b45e1642b530ee6dc555240, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &6085469794438535834 --- !u!1 &6085469794438535834
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

+ 10
- 2
Assets/Scripts/BabyController.cs View File

@ -9,6 +9,8 @@ public class BabyController : MonoBehaviour
public Vector3 targetVector; public Vector3 targetVector;
private Rigidbody rb; private Rigidbody rb;
private YeetHandle yeetHandle;
public float speed; public float speed;
private float timer = 0; private float timer = 0;
@ -19,6 +21,7 @@ public class BabyController : MonoBehaviour
void Start() void Start()
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
yeetHandle = GetComponent<YeetHandle>();
currentVector = RandomNormVector(); currentVector = RandomNormVector();
targetVector = RandomNormVector(); targetVector = RandomNormVector();
@ -28,8 +31,13 @@ public class BabyController : MonoBehaviour
void FixedUpdate() void FixedUpdate()
{ {
currentVector = Vector3.Slerp(currentVector, targetVector, Time.deltaTime);
rb.MovePosition(transform.position + (currentVector * speed));
if(!yeetHandle.held)
{
currentVector = Vector3.Slerp(currentVector, targetVector, Time.deltaTime);
rb.MovePosition(transform.position + (currentVector * speed));
}
timer += Time.deltaTime; timer += Time.deltaTime;
if (timer > randTimer) if (timer > randTimer)

+ 4
- 0
Assets/Scripts/Behaviours/YeetController.cs View File

@ -32,6 +32,8 @@ public class YeetController : MonoBehaviour
{ {
_child = child; _child = child;
_child.transform.parent = parent.transform; _child.transform.parent = parent.transform;
_child.GetComponent<YeetHandle>().held = true;
yeetState = YeetState.Held; yeetState = YeetState.Held;
m_lineRenderer = gameObject.AddComponent<LineRenderer>(); m_lineRenderer = gameObject.AddComponent<LineRenderer>();
@ -41,6 +43,8 @@ public class YeetController : MonoBehaviour
{ {
_child.transform.parent = null; _child.transform.parent = null;
_child.transform.rotation = parent.transform.rotation; _child.transform.rotation = parent.transform.rotation;
_child.GetComponent<YeetHandle>().held = true;
_child.GetComponent<Rigidbody>().velocity = _child.transform.forward * m_velocityWindup + _child.transform.up * m_velocityWindup; _child.GetComponent<Rigidbody>().velocity = _child.transform.forward * m_velocityWindup + _child.transform.up * m_velocityWindup;
yeetState = YeetState.Yeeting; yeetState = YeetState.Yeeting;
m_time = yeetDuration; m_time = yeetDuration;

+ 3
- 0
Assets/Scripts/Behaviours/YeetHandle.cs View File

@ -6,6 +6,8 @@ public class YeetHandle : MonoBehaviour
{ {
private BoxCollider m_handleArea; private BoxCollider m_handleArea;
public bool held { get; set; }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -20,4 +22,5 @@ public class YeetHandle : MonoBehaviour
{ {
} }
} }

+ 5
- 0
Assets/Scripts/LookAtCamera.cs View File

@ -17,4 +17,9 @@ public class LookAtCamera : MonoBehaviour
transform.rotation = _cameraObj.transform.rotation; transform.rotation = _cameraObj.transform.rotation;
transform.Rotate(new Vector3(0, 180, 0)); transform.Rotate(new Vector3(0, 180, 0));
} }
private void LateUpdate()
{
UpdateRotation();
}
} }

Loading…
Cancel
Save