77 lines
1.9 KiB
C#
77 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
namespace Beyond
|
|
{
|
|
|
|
public class CombinationTrigger : QuestTriggerBase
|
|
{
|
|
public ActionResponse[] m_correctResponses;
|
|
public ActionResponse m_incorrectResponse;
|
|
|
|
//public int m_numTiggers = 3;
|
|
int m_currentNum = 0;
|
|
// Start is called before the first frame update
|
|
public float m_onCorrectDelay = 0f;
|
|
public float m_onIncorrectDelay = 0f;
|
|
public bool m_useOnce = true;
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
IEnumerator Incorrect()
|
|
{
|
|
if (m_onIncorrectDelay > 0f)
|
|
yield return new WaitForSeconds(m_onIncorrectDelay);
|
|
m_onIncorrect?.Invoke();
|
|
}
|
|
|
|
IEnumerator Correct()
|
|
{
|
|
if (m_onCorrectDelay > 0f)
|
|
yield return new WaitForSeconds(m_onIncorrectDelay);
|
|
m_onCorrect?.Invoke();
|
|
}
|
|
*/
|
|
|
|
public void OnAction(int num)
|
|
{
|
|
if (num == m_currentNum)
|
|
{
|
|
//m_currentNum++;
|
|
/*
|
|
if (m_currentNum == m_numTiggers)
|
|
{
|
|
StartCoroutine(Correct());
|
|
if (m_useOnce)
|
|
enabled = false;
|
|
}
|
|
*/
|
|
OnActionResponse(m_correctResponses[m_currentNum]);
|
|
m_currentNum++;
|
|
if (m_currentNum == m_correctResponses.Length)
|
|
{
|
|
if (m_useOnce)
|
|
enabled = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m_currentNum = 0;
|
|
OnActionResponse(m_incorrectResponse);
|
|
}
|
|
}
|
|
}
|
|
} |