Commit b9b7972e authored by abpo11's avatar abpo11

idle , 걷기, 뛰기, 로프, 점프 상태 구현함. 공격은 애니메이션 틀만 만듬

parent 0cc78875
This diff is collapsed.
fileFormatVersion: 2
guid: f296ed247a14fdc47aaf4e337d976d96
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -215,6 +215,7 @@ GameObject:
- component: {fileID: 489222434}
- component: {fileID: 489222438}
- component: {fileID: 489222439}
- component: {fileID: 489222440}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
......@@ -379,6 +380,24 @@ MonoBehaviour:
LCUI: {fileID: 0}
ttx: 0
tty: 0
--- !u!95 &489222440
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 489222433}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: f296ed247a14fdc47aaf4e337d976d96, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1001 &695959412
Prefab:
m_ObjectHideFlags: 0
......
......@@ -6,7 +6,7 @@ using UnityEngine.Tilemaps;
public class PlayerController : MonoBehaviour
{
private Rigidbody2D rb; // RigidBody2D of this game object
private Animator anim;
// Speeds of player
[SerializeField]
private float maxSpeed;
......@@ -59,6 +59,7 @@ public class PlayerController : MonoBehaviour
void Start()
{
rb = gameObject.GetComponent<Rigidbody2D>();
anim = GetComponent<Animator>();
}
// Update is called once per frame
......@@ -80,6 +81,16 @@ public class PlayerController : MonoBehaviour
if (GameManager.gameState == GameManager.GameState.Ingame)
{
anim.SetBool("rope",isInRope);
anim.SetBool("run", isDashing);
anim.SetBool("ground", isGrounded);
anim.SetFloat("vspeed", rb.velocity.y);
anim.SetFloat("speed", Mathf.Abs(rb.velocity.x));
if(isGrounded || isInRope)
{
anim.SetBool("jump", false);
}
if (isGrounded)
isJumpable = true;
......@@ -137,10 +148,12 @@ public class PlayerController : MonoBehaviour
if (isGrounded)
{
vertical = jumpSpeed;
anim.SetBool("jump", true);
}
else if (isJumpable)
{
vertical = doubleJumpSpeed;
anim.SetBool("jump", true);
isJumpable = false;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment