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; } }
public void LoadClothing(Resource.ResourceManager content) { // apparently when an actor is loaded we need to look // for the most recent [Actor]CLOTHES[Timeblock].ANM file. // So start at the current timeblock and work backwards. Game.Timeblock now = Game.GameManager.CurrentTime; MomResource clothesAnm = null; for (int timeblock = (int)now; timeblock >= 0; timeblock--) { try { string file = _code + "CLOTHES" + Game.GameManager.GetTimeBlockString((Timeblock)timeblock); clothesAnm = content.Load <MomResource>(file); // guess we found it break; } catch (System.IO.FileNotFoundException) { // didn't find it, so keep looking } } if (clothesAnm != null) { clothesAnm.Play(); } }
public static WaitHandle PlayMom(string momFile, bool wait) { _lastMom = SceneManager.SceneContentManager.Load <Game.MomResource>("E" + momFile + ".MOM"); _lastMom.Play(); if (wait) { _waitingOnMom = true; return(_waitHandle); } return(null); }
internal static WaitHandle Add(MomResource anm, bool wait) { anm.ReferenceCount++; add(_anms, anm); if (wait) { return(anm.PlayAndWait()); } anm.Play(); return(null); }
public Resource.Resource Load(string name, Resource.ResourceManager content) { if (name.IndexOf('.') < 0) { name += ".ANM"; } System.IO.Stream stream = FileSystem.Open(name); MomResource resource = new MomResource(name, stream, content); stream.Close(); return(resource); }
void execAnim(GasParam[] cparams) { string filename = cparams[0].StringValue; bool moving = (cparams.Length > 1 ? cparams[1].BooleanValue : false); int percent = (cparams.Length > 2 ? cparams[2].IntegerValue : 100); if (percent < 100) { // roll a dice to see if we're even going to execute this animation if (Utils.RollFloatingDie() > percent * 0.01f) { return; } } //AnmResource anm = (AnmResource)Resource.ResourceManager.Load(string.Format("{0}.ANM", filename)); //MomResource mom = (MomResource)Resource.ResourceManager.Load(string.Format("{0}.ANM", filename)); MomResource mom = _content.Load <MomResource>(filename); _currentWait = Animator.Add(mom, true); _suspended = true; }
public AnmWaitHandle(MomResource mom) { _mom = mom; }