示例#1
0
    private void _SetCurrentEvent(EventBase newEvent)
    {
        if (newEvent == null)
        {
            Debug.LogError("NewEvent needs to be valid");
            return;
        }
        currentEvent = newEvent;
        currentEvent.StartEvent();

        if (currentEvent == null)
        {
            //Debug.Log("Event disposed of itself and didn't spawn follow ups.");
            return;
        }

        if (currentEvent.EventChoices == null)
        {
            Debug.Log("Event didn't have valid choices: " + newEvent.ToString());
            currentEvent.EventChoices = new List <Choice>();
        }
        else
        {
            foreach (var choice in currentEvent.EventChoices)
            {
                if (choice.DisplayOnEventStart == true)
                {
                    currentEvent.DisplayChoice(choice);
                }
            }

            currentEvent.EventChoices.Clear();
        }

        if (currentEvent.Text == "")
        {
            Debug.LogError("Event didn't get Text specified: " + newEvent.ToString());
        }
        var actor = newEvent.ConversationActor;

        if (actor == null)
        {
            Debug.LogError("Event doesn't define a ConversationActor " + newEvent.ToString());
        }

        if (OnEventStart != null)
        {
            OnEventStart(newEvent);
        }
    }