Пример #1
0
    void StartEvent()
    {
        if (eventRoutine != null)
        {
            curAI.StopCoroutine(eventRoutine);
        }
        if (repeatRoutine != null)
        {
            curAI.StopCoroutine(repeatRoutine);
        }

        eventRoutine = curAI.StartCoroutine(StartTriggerEvent());
    }
Пример #2
0
    public void DoEvent(UnitAITrigger _trigger, int _index, Collider _col = null)
    {
        curAI = _trigger.CurAi;
        if (!equip)
        {
            equip = curAI.GetComponent <UnitEquip>();
        }
        index    = _index;
        finished = false;

        if (_col)
        {
            curTarget = _col;
        }

        if (startType == StartType.Instant)
        {
            StartEvent();
        }
        else if (startType == StartType.WaitForPreviousToFinish && index > 0)
        {
            if (waitRoutine != null)
            {
                curAI.StopCoroutine(waitRoutine);
            }

            waitRoutine = curAI.StartCoroutine(StartWaitForPrevious(_trigger));
        }
    }
Пример #3
0
    public void DoEvent(UnitAITrigger _trigger, int _index, Collider2D _col = null)
    {
        curAI = _trigger.CurAi;
        index = _index;
        if (_col)
        {
            curTarget = _col;
        }

        if (startType == StartType.Instant)
        {
            curAI.StartCoroutine(StartTriggerEvent());
        }
        else if (startType == StartType.WaitForPreviousToFinish && index > 0)
        {
            curAI.StartCoroutine(StartWaitForPrevious(_trigger));
        }
    }
Пример #4
0
    IEnumerator StartWaitForPrevious(UnitAITrigger _trigger)
    {
        var lastEvent = _trigger.events[index - 1];

        while (!lastEvent.finished)
        {
            yield return(new WaitForEndOfFrame());
        }
        curAI.StartCoroutine(StartTriggerEvent());
    }