예제 #1
0
    public ToneGenerator(NoteCtrl noteCtrl, int sampleRate, int channels)
    {
        noteCtrl.Subscribe(this);

        signalGenerator = new SignalGenerator(sampleRate, channels)
        {
            Gain = Gain,
            Frequency = Frequency,
            Type = SignalGeneratorType.Sin
        };
    }
예제 #2
0
    public void AddChainedNote(NoteCtrl note)
    {
        m_ChainRenderer.SetPosition(m_ChainCount, (Vector2)note.transform.position - m_StartPos);

        m_ChainCount++;

        m_ChainRenderer.positionCount++;
        m_ChainRenderer.SetPosition(m_ChainCount, (Vector2)note.transform.position - m_StartPos);

        note.Touched();

        UIManager.Instance.IncreaseGauge();

        if (m_ChainCount > m_MinusMatchCount && m_IsEvading == false)
        {
            UIManager.Instance.m_SlateCtrl.SwitchPlayerAttackIcon(true);
        }

        // 8개 패턴 모드 매칭되는 경우
        if (m_ChainCount == 8)
        {
            // 타이틀 패턴 해금
            if (GameManager.Instance.m_IsTitle)
            {
                ClearFieldAndSlate(false);
                return;
            }

            TouchManager.Instance.m_IsPressing = false;

            DoAttack();

            if (m_IsEvading)
            {
                m_IsEvading = false;
                TimeManager.Instance.StartBossTimer();
                UIManager.Instance.ChangeSlate();
            }

            ClearFieldAndSlate(false);

            return;
        }
    }
예제 #3
0
    public void InitChain(NoteCtrl note)
    {
        Debug.Log("Start Note Chain");

        m_ChainCount = 1;

        m_ChainRenderer.positionCount = 2;

        m_StartPos         = note.transform.position;
        transform.position = note.transform.position;

        m_ChainRenderer.SetPosition(0, Vector2.zero);
        m_ChainRenderer.SetPosition(1, Vector2.zero);

        m_TouchChainNotes.Add(note);

        note.Touched();

        UIManager.Instance.IncreaseGauge();
    }
예제 #4
0
    public void CheckNote(NoteCtrl note)
    {
        // 체인된 노트가 최초 체인 노트일 경우
        if (m_TouchChainNotes.Count == 0)
        {
            if (note.m_Type != m_MonsterNotes[0])
            {
                TouchManager.Instance.m_IsPressing = false;
                StartCoroutine(CorShakeField());
                return;
            }

            InitChain(note);
            return;
        }

        // 마지막 체인 노트와 현재 체인된 노트가 동일한 경우
        if (m_TouchChainNotes[m_ChainCount - 1] == note)
        {
            // 아무 것도 하지 않음
            return;
        }

        // 체인된 노트와 몬스터 현재 패턴 노트와 다를 경우
        // !! 패턴 입력 실패 !!
        if (note.m_Type != m_MonsterNotes[m_ChainCount])
        {
            Debug.Log("Pattern Failed, [" + m_ChainCount +
                      "] touch : " + note.m_Type + " mob : " + m_MonsterNotes[m_ChainCount]);

            StartCoroutine(CorShakeField());

            return;
        }

        m_TouchChainNotes.Add(note);
        AddChainedNote(note);
    }
예제 #5
0
    private void Update()
    {
        if (GameManager.Instance.m_GameState != GameState.CanTouch)
        {
            return;
        }

#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(0))
        {
            m_IsPressing = true;
            return;
        }

        if (Input.GetMouseButton(0) && m_IsPressing)
        {
            Ray          ray = mainCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction
                                                 , 100f
                                                 , 1 << LayerMask.NameToLayer(Constant.Layer_Note));
            if (hit)
            {
                NoteCtrl touchedNote = hit.transform.GetComponent <NoteCtrl>();
                //Debug.Log("Touch : " + touchedNote.name);
                NoteManager.Instance.CheckNote(touchedNote);
                return;
            }

            NoteManager.Instance.MoveLastChain(
                mainCamera.ScreenToWorldPoint(Input.mousePosition));

            return;
        }

        if (Input.GetMouseButtonUp(0) && m_IsPressing)
        {
            Debug.Log("MouseButtonUp");

            m_IsPressing = false;

            // 3번 초기화
            if (NoteManager.Instance.CheckAllNoteMatching())
            {
                TimeManager.Instance.ChangePlayerAttackTimer();
            }
            return;
        }
#else
        Touch touch = Input.GetTouch(0);

        switch (touch.phase)
        {
        case TouchPhase.Began:
            Ray          ray = mainCamera.ScreenPointToRay(touch.position);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);
            if (hit.transform.CompareTag(Constant.TAG_CRYSTAL))
            {
                chainList.Add(hit.transform.GetComponent <CellCtrl>());
            }
            break;

        case TouchPhase.Moved:
            break;

        case TouchPhase.Ended:
            break;
        }
#endif
    }