Moster.cs


using System.Collections;
using UnityEngine;

public class Monster : MonoBehaviour
{
    public int currentHp = 1;
    public float moveSpeed = 5f;
    public float jumpPower = 10;
    public float atkCoolTime = 3f;
    public float atkCoolTimeCalc = 3f;

    public bool isHit = false;
    public bool isGround = true;
    public bool canAtk = true;
    public bool MonsterDirRight;

    protected Rigidbody2D rb;
    protected BoxCollider2D boxCollider;
    public GameObject hitBoxCollider;
    public Animator Anim;
   //플래폼감지
    public LayerMask layerMask;


    protected void Awake ( )
    {  //컴포넌트 로드
        rb = GetComponent<Rigidbody2D> ( );
        boxCollider = GetComponent<BoxCollider2D> ( );
        Anim = GetComponent<Animator> ( );

        StartCoroutine ( CalcCoolTime ( ) );
        StartCoroutine ( ResetCollider ( ) );
    }

    IEnumerator ResetCollider ( )  
    {   //몬스터 죽었을때 꺼진 히트박스 다시 켜줌

        while ( true )
        {
            yield return null;
            if ( !hitBoxCollider.activeInHierarchy )
            {
                yield return new WaitForSeconds ( 0.5f );
                hitBoxCollider.SetActive ( true );
                isHit = false;
            }
        }
    }
    //공격가능한쿨타임
    IEnumerator CalcCoolTime ( )
    {
        while ( true )
        {
            yield return null;
            if ( !canAtk )
            {
                atkCoolTimeCalc -= Time.deltaTime;
                if ( atkCoolTimeCalc <= 0 )
                {
                    atkCoolTimeCalc = atkCoolTime;
                    canAtk = true;
                }
            }
        }
    }

    public bool IsPlayingAnim ( string AnimName )
    {
        if ( Anim.GetCurrentAnimatorStateInfo ( 0 ).IsName ( AnimName ) )
        {
            return true;
        }
        return false;
    }
    public void MyAnimSetTrigger ( string AnimName )
    {
        if ( !IsPlayingAnim ( AnimName ) )
        {
            Anim.SetTrigger ( AnimName );
        }
    }

    protected void MonsterFlip ( )
    {
        MonsterDirRight = !MonsterDirRight;

        Vector3 thisScale = transform.localScale;
        if ( MonsterDirRight )
        {
            thisScale.x = -Mathf.Abs ( thisScale.x );
        }
        else
        {
            thisScale.x = Mathf.Abs ( thisScale.x );
        }
        transform.localScale = thisScale;
        rb.velocity = Vector2.zero;
    }
    //몬스터가 플레이어방향으로 향하고있는지 체크
    protected bool IsPlayerDir ( )
    {
        if ( transform.position.x < PlayerData.Instance.Player.transform.position.x ? MonsterDirRight : !MonsterDirRight )
        {
            return true;
        }
        return false;
    }

    protected void GroundCheck ( )
    {
        if ( Physics2D.BoxCast ( boxCollider.bounds.center, boxCollider.size, 0, Vector2.down, 0.05f, layerMask ) )
        {
            isGround = true;
        }
        else
        {
            isGround = false;
        }
    }

    public void TakeDamage ( int dam )
    {
        currentHp -= dam;
        isHit = true;
        // Knock Back or Dead
        hitBoxCollider.SetActive ( false );
    }

     protected void OnTriggerEnter2D ( Collider2D collision )
    {
        //if ( collision.transform.CompareTag ( ?? ) )
        //{
            //TakeDamage ( 0 );
        //}
    }
}





MushRoom.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mushroom : Monster
{
    public Transform[] wallCheck;

    private void Awake ( ) //요부분에 Awake가 노란 밑줄이 그어집니다. 'Mushroom.Awake()'은(는) 상속된
'Monster.Awake()' 멤버를 숨깁니다. 숨기려면 new 키워드를 사용하세요. [Assembly-CSharp] 창뜸.
    {
        base.Awake ( );
        moveSpeed = 2f;
        jumpPower = 15f;
    }

    // Update is called once per frame
    void Update ( )
    {
        if ( !isHit )
        {
            rb.velocity = new Vector2 ( -transform.localScale.x * moveSpeed, rb.velocity.y );

            if ( !Physics2D.OverlapCircle ( wallCheck[0].position, 0.01f, layerMask ) &&
                Physics2D.OverlapCircle ( wallCheck[1].position, 0.01f, layerMask ) &&
                 !Physics2D.Raycast ( transform.position, -transform.localScale.x * transform.right, 1f, layerMask ) )
            {
                rb.velocity = new Vector2 ( rb.velocity.x, jumpPower );
            }
            else if ( Physics2D.OverlapCircle ( wallCheck[1].position, 0.01f, layerMask ) )
            {
                MonsterFlip ( );
            }
        }

    }
    protected void OnTriggerEnter2D ( Collider2D collision ) //OnTriggerEnter2D도 노란밑줄됨
    {
        base.OnTriggerEnter2D ( collision );
        if ( collision.transform.CompareTag ( "PlayerHitBox" ) )
        {
            MonsterFlip ( );
        }
    }
}



게임상에 적용하면 밑줄이 생기는데 원인을 모르겠습니다.