Example #1
0
    void OnTriggerExit(Collider other)
    {
        if (other == null)
        {
            return;
        }
        if (character == null)
        {
            return;
        }
        if (EventStatus != Status.Entered)
        {
            return;
        }

        if (WillSuccess)
        {
            EventStatus = Status.Success;
            StartCoroutine(WaitForSuccess());
            if (onEventSuccess != null)
            {
                onEventSuccess(character);
            }
            character.OnEventExit();
        }
        else
        {
            EventStatus = Status.Failed;
            GameController.Instance.GameOver();
            if (onEventFailed != null)
            {
                onEventFailed(character);
            }
        }

        character = null;
    }