Attached glider animation

main
Ivy 4 years ago
parent 881e9c468e
commit f190d83f6a

@ -13532,7 +13532,7 @@ Transform:
- {fileID: 993848333}
- {fileID: 1620187171}
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &993848332
GameObject:
@ -13842,6 +13842,63 @@ Tilemap:
e31: 0
e32: 0
e33: 1
--- !u!1001 &1404422570
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalPosition.x
value: 18.722578
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalPosition.y
value: -2.2699764
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081608, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3406909610842081614, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
propertyPath: m_Name
value: Glider Powerup placeholder
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 017d2509132c9428fbed8092b26dfaba, type: 3}
--- !u!1 &1620187170
GameObject:
m_ObjectHideFlags: 0

@ -8,7 +8,6 @@ public class Glider : MonoBehaviour
[SerializeField]
private float m_FallSpeed = 0f;
private Animator animator;
/// <summary>
///
@ -20,7 +19,6 @@ public class Glider : MonoBehaviour
void Awake()
{
m_Rigidbody2D = GetComponent<Rigidbody2D>();
animator = GetComponent<Animator>();
}
// Update is called once per frame
@ -29,11 +27,6 @@ public class Glider : MonoBehaviour
if (IsGliding && m_Rigidbody2D.velocity.y < 0f && Mathf.Abs(m_Rigidbody2D.velocity.y) > m_FallSpeed)
{
m_Rigidbody2D.velocity = new Vector2(m_Rigidbody2D.velocity.x, Mathf.Sign(m_Rigidbody2D.velocity.y) * m_FallSpeed);
animator.SetBool("isGliding", true);
}
else
{
animator.SetBool("isGliding", false);
}
}

@ -21,6 +21,8 @@ public class movement : MonoBehaviour
private int numJumps;
private bool isGrounded = true;
private Glider glider;
public AudioClip[] clips;
private AudioSource a;
@ -31,18 +33,21 @@ public class movement : MonoBehaviour
numJumps = maxJumps;
animator = GetComponent<Animator>();
a = GetComponent<AudioSource>();
glider = GetComponent<Glider>();
}
// Update is called once per frame
void Update()
{
{
Debug.Log("glider.IsGliding" + glider.IsGliding);
animator.SetBool("isGliding", glider.IsGliding);
if (Input.GetKeyDown("space") && numJumps > 0 && !GameManager.Instance.isPaused())
{
rb2d.velocity = new Vector2(rb2d.velocity.x, 0);
rb2d.AddForce(new Vector2(0, jumpForce));
isGrounded = false;
numJumps -= 1;
numJumps -= 1;
}
}

Loading…
Cancel
Save