예제 #1
0
        public static void Step()
        {
            // continue the Mom
            if (_lastMom != null)
            {
                _lastMom.Step();
            }

            // if the last played yak is finished then see if there are more yaks to play
            if (_lastYak != null && _lastYak.Value.IsFinished)
            {
                if (_numLinesToPlay > _linesPlayed)
                {
                    // load the new yak
                    _lastLicensePlate = incrementLicensePlate(_lastLicensePlate, 1);

                    YakResource yak = SceneManager.SceneContentManager.Load <YakResource>("E" + _lastLicensePlate);
                    _lastYak = new LinkedListNode <YakResource>(yak);
                    _yaks.AddLast(_lastYak);

                    // play the yak
                    //yak.Play();
                    Animator.Add(yak, false);

                    _linesPlayed++;
                }
            }

            // remove any finished yaks
            for (LinkedListNode <YakResource> yakNode = _yaks.First; yakNode != null;)
            {
                if (yakNode.Value.IsPlaying == false)
                {
                    if (_lastYak == yakNode)
                    {
                        _lastYak = null;

                        if (_numLinesToPlay == _linesPlayed)
                        {
                            _numLinesToPlay = 0;
                            _linesPlayed    = 0;
                        }
                    }

                    LinkedListNode <YakResource> next = yakNode.Next;
                    _yaks.Remove(yakNode);
                    yakNode = next;
                }
                else
                {
                    yakNode = yakNode.Next;
                }
            }

            // if the Mom is finished then get rid of it
            if (_lastMom != null && _lastMom.IsFinished)
            {
                _lastMom = null;
            }
        }
예제 #2
0
        public static WaitHandle PlayDialogue(string licensePlate, int numLines, bool plateHasLanguageCode, bool wait)
        {
            if (plateHasLanguageCode == false)
            {
                licensePlate = "E" + licensePlate;
            }

            YakResource yak = SceneManager.SceneContentManager.Load <YakResource>(string.Format("{0}.YAK", licensePlate));

            _lastYak = new LinkedListNode <YakResource>(yak);
            _yaks.AddLast(yak);
            _lastLicensePlate = licensePlate.Substring(1); // remove the language code
            _numLinesToPlay   = numLines;
            _linesPlayed      = 1;

            //yak.Play();
            Animator.Add(yak, false);

            if (wait)
            {
                return(_waitHandle);
            }

            return(null);
        }
예제 #3
0
        internal static WaitHandle Add(YakResource yak, bool wait)
        {
            yak.ReferenceCount++;

            add(_yaks, yak);

            if (wait)
            {
                return(yak.PlayAndWait());
            }

            yak.Play();
            return(null);
        }
예제 #4
0
        public Resource.Resource Load(string name, Resource.ResourceManager content)
        {
            if (name.IndexOf('.') < 0)
            {
                name += ".YAK";
            }

            System.IO.Stream stream = FileSystem.Open(name);

            YakResource resource = new YakResource(name, stream, content);

            stream.Close();

            return(resource);
        }