// Use this for initialization void Start() { m_controller = GetComponent <CharacterController>(); m_blender = GetComponent <MonsterColorBlend>(); m_animator = GetComponent <Animator>(); m_state = EndermanState.Alive; }
// Update is called once per frame void Update() { if (yukari != null) { if (m_controller.isGrounded) { if (m_knockBack) { } } } // Control hit animation if (m_hitAnimationTimer < 0.5f) { m_hitAnimationTimer += Time.deltaTime; m_animator.speed = 5f; } else if (m_hitAnimationTimer >= 0.5f) { m_hitAnimationTimer = 0.5f; m_animator.speed = 1f; } // Check whether it is dead if (health <= 0) { m_hitAnimationTimer = 0.5f; m_animator.speed = 1f; m_animator.SetBool("Dead", true); m_state = EndermanState.Dead; } // 이 코드는 가장 아래에 있어야 한다 moveDirection.y -= gravity * Time.deltaTime; m_controller.Move(moveDirection * Time.deltaTime); }