Esempio n. 1
0
        private static void loadSifModels(Game.SifResource sif)
        {
            foreach (Game.SifModel model in sif.Models)
            {
                if (model.Type == Gk3Main.Game.SifModelType.Prop ||
                    model.Type == SifModelType.GasProp)
                {
                    AddModel(model.Name, !model.Hidden &&
                             GameManager.IsInInventory(model.Noun, true) == false &&
                             GameManager.IsInInventory(model.Noun, false) == false);

                    if (model.Type == SifModelType.GasProp)
                    {
                        AddGas(model.Gas);
                    }
                }

                if (_currentRoom != null)
                {
                    // hide the surface if it shouldn't be visible
                    if (model.Type == SifModelType.HitTest || model.Hidden)
                    {
                        _currentRoom.SetSurfaceVisibility(model.Name, false);
                    }
                }

                if (string.IsNullOrEmpty(model.Noun) == false && _modelNounMap.ContainsKey(model.Name) == false)
                {
                    Nouns n = NounUtils.ConvertStringToNoun(model.Noun);
                    _modelNounMap.Add(model.Name, n);
                }

                // play the first frame of the init animation (if it exists)
                if (model.InitAnim != null)
                {
                    _sceneContentManager.Load <MomResource>(model.InitAnim + ".ANM").Play(true);
                }
            }
        }
Esempio n. 2
0
        private static void loadSifActorModels(Game.SifResource sif)
        {
            foreach (Game.SifActor actor in sif.Actors)
            {
                AddActor(actor.Model, actor.Noun, Math.Vector3.Zero, 0, actor.IsEgo);

                if (string.IsNullOrEmpty(actor.Pos) == false)
                {
                    SetActorPosition(actor.Noun, actor.Pos);
                }

                if (string.IsNullOrEmpty(actor.Noun) == false)
                {
                    Nouns n = NounUtils.ConvertStringToNoun(actor.Noun);
                    _modelNounMap.Add(actor.Model, n);
                }

                // play the first frame of the init animation (if it exists)
                if (actor.InitAnim != null)
                {
                    try
                    {
                        _sceneContentManager.Load <MomResource>(actor.InitAnim + ".ANM").Play(true);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                        // apparently, especially when playing the GK3 demo,
                        // some SIF files can refer to actors that don't actually
                        // exist in the demo, so we need to ignore these errors
                    }
                }
                else if (actor.Idle != null)
                {
                    // play the idle animation
                    _sceneContentManager.Load <GasResource>(actor.Idle).Play();
                }
            }
        }