private void PlayStep(OngoingEvent whichEvent, int stepIndex)
    {
        //Debug.Log ("Playing current step of index " + uniqueId + " : " + stepIndex);
        whichEvent.FinishedEvents = new bool[GetNbOfEventsInCurrentStep(whichEvent)];
        int nbOfEvents = whichEvent.FinishedEvents.Length;

        //Debug.Log ("Number of events in step " + o.Index + ": " + nbOfEvents);

        if (nbOfEvents > 0)
        {
            for (int i = 0; i < whichEvent.GameEvent[stepIndex].actions.Length; i++)
            {
                if (whichEvent.GameEvent[stepIndex].actions[i] != null)
                {
                    whichEvent.GameEvent[stepIndex].actions[i].PlayAction(whichEvent.UniqueID);
                }
                else
                {
                    Debug.LogWarning("EventPlayer/PlayStep (OngoingEvent, int) : an event was null : whichEventID (" + whichEvent.UniqueID + ") / Step (" + stepIndex + ")");
                    OneEventDone(whichEvent);
                }
            }

            //{
            //Debug.Log ("Now playing debugLog for event at index " + uniqueId + " at step " + stepIndex);
            //DebugLog (whichEvent, whichEvent.GameEvent[stepIndex].debugLog.logMessage);
            //}

            // DELAY
            //if (/*!stepIsOver && */whichEvent.GameEvent[stepIndex].delay.active)
            //{
            //Debug.Log ("Now playing delay for event at index " + uniqueId + " at step " + stepIndex);
            //Debug.Log ("Duration is " + o.GameEvent[stepIndex].delay.duration);
            //Delay (whichEvent, whichEvent.GameEvent[stepIndex].delay.duration);
            //}

            //if (whichEvent.GameEvent[stepIndex].moveCharacter.active)
            //{
            //	MoveCharacter (whichEvent);
            //}

            //if (whichEvent.GameEvent[stepIndex].charAnimation.active)
            //{
            //	ChangeCharacterAnimation (whichEvent);
            //}
        }
        else
        {
            OneEventDone(whichEvent);
        }
    }
    private bool StepIsOver(OngoingEvent whichEvent)
    {
        bool isOver = true;

        for (int i = 0; isOver && i < whichEvent.FinishedEvents.Length; i++)
        {
            if (!whichEvent.FinishedEvents[i])
            {
                isOver = false;
            }
        }
        //stepIsOver = isOver;
        return(isOver);
    }
        //Event
        void CheckEvents()
        {
            if (InitiatedEvents)
            {
                return;
            }

            EventInfo.VerifyHardCoded();

            OngoingEvent.LoadOngoing();

            _ = OngoingEvent.StartWait();

            InitiatedEvents = true;
        }
    private void UpdateFinished(OngoingEvent whichEvent)
    {
        //Debug.Log ("Updating bools");
        bool foundOne = false;

        for (int i = 0; !foundOne && i < whichEvent.FinishedEvents.Length; i++)
        {
            if (!whichEvent.FinishedEvents[i])
            {
                foundOne = true;
                whichEvent.FinishedEvents[i] = true;
            }
        }
        if (!foundOne)
        {
            //Debug.Log ("Error in updating");
        }
    }
 private void TryNext(OngoingEvent whichEvent)
 {
     if (StepIsOver(whichEvent))
     {
         //Debug.Log ("Step is over");
         if (IncreaseStepIndex(whichEvent) < whichEvent.GameEvent.Length)
         {
             PlayCurrentStep(whichEvent);
         }
         else
         {
             EventIsOver(whichEvent);
         }
     }
     else
     {
         //Debug.Log ("Event done but not over");
     }
 }
 private void OneEventDone(OngoingEvent whichEvent)
 {
     UpdateFinished(whichEvent);
     TryNext(whichEvent);
 }
 private void StartPlaying(OngoingEvent toPlay)
 {
     PlayCurrentStep(toPlay);
 }
 public void EventIsOver(OngoingEvent whichEvent)
 {
     Debug.Log("Event " + whichEvent + " is over!");
     toPlay.Remove(whichEvent);
 }
 int GetNbOfEventsInStep(OngoingEvent whichEvent, int stepIndex)
 {
     return(whichEvent.GameEvent[stepIndex].actions.Length);
 }
示例#10
0
 int GetNbOfEventsInCurrentStep(OngoingEvent whichEvent)
 {
     return(GetNbOfEventsInStep(whichEvent, whichEvent.Index));
 }
示例#11
0
 private void PlayCurrentStep(OngoingEvent whichEvent)
 {
     PlayStep(whichEvent, whichEvent.Index);
 }
示例#12
0
 private int IncreaseStepIndex(OngoingEvent whichEvent)
 {
     //Debug.Log ("Going to next step : " + (o.Index + 1));
     //Debug.Log ((o.Index + 1 < o.GameEvent.Length).ToString ());
     return(++whichEvent.Index);
 }