커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
어디서부턴가 잘 못 되었는데 어디서 잘 못 된 건지 모르겠습니다ㅠㅠ
undefined주차
북마크
황*훈
댓글
6
추천
0
조회수
26
조회수
26
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


유니티 설정에서 잘 못 된 건지 모르겠는데 처음에 카드 위치 설정 당시 일렬로 배열되던 것을 계단식 배열까지는 성공 시켰는데 이후 코딩으로 다시 가운데 한 점으로 모여버렸습니다ㅠㅠ

그리고 ai 첨삭으로 돌려봤더니 아래와 같이 문제점을 찝어주는데 이게 무슨 말인지도 잘 모르겠습니다ㅠㅠ


✅ AI 첨삭 결과: 

1. line 8 : Animator 변수를 선언하고 초기화하지 않았습니다. 객체를 참조하기 위해서는 반드시 초기화가 필요합니다. 


2. line 24 : gameManager.I.firstCard 변수를 사용하기 위해서는 반드시 초기화가 필요합니다. 


3. line 27 : gameManager.I.secondCard 변수를 사용하기 위해서는 반드시 초기화가 필요합니다. 


4. line 28 : gameManager.I.isMatched() 함수를 사용하기 위해서는 반드시 초기화가 필요합니다. 


5. line 37 : Invoke 함수를 사용하기 위해서는 반드시 destroyCardInvoke 함수가 정의되어 있어야 합니다. 


6. line 44 : Invoke 함수를 사용하기 위해서는 반드시 closeCardInvoke 함수가 정의되어 있어야 합니다.


스파르타 즉문즉답




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


public class card : MonoBehaviour
{
    public Animator anim;
    // Start is called before the first frame update
    void Start()
    {
        
    }


    // Update is called once per frame
    void Update()
    {
        
    }
    public void openCard()
    {
        anim.SetBool("isOpen", true);
        // Animator isOpen = True
        transform.Find("front").gameObject.SetActive(true);
        // Front setActive = True
        transform.Find("back").gameObject.SetActive(false);
        // Back setActive = False


        if (gameManager.I.firstCard == null)
        {
            gameManager.I.firstCard = gameObject;
        }
        else
        {
            gameManager.I.secondCard = gameObject;
            gameManager.I.isMatched();
        }
    }
    public void destroyCard()
    {
        Invoke("destroyCardInvoke", 1.0f);
    }


    void destroyCardInvoke()
    {
        Destroy(gameObject);
    }


    public void closeCard()
    {
        Invoke("closeCardInvoke", 1.0f);
    }


    void closeCardInvoke()
    {
        anim.SetBool("isOpen", false);
        transform.Find("back").gameObject.SetActive(true);
        transform.Find("front").gameObject.SetActive(false);
    }


}




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴