コード例 #1
0
ファイル: Creatures.cs プロジェクト: yazici/FRONTIERS
        public override void WakeUp()
        {
            base.WakeUp();

            Get = this;

            gDarkrotSpawner            = new GenericWorldItem();
            gDarkrotSpawner.PackName   = "Oblox";
            gDarkrotSpawner.PrefabName = "DarkrotSpawner";

            mTemplateLookup = new Dictionary <string, CreatureTemplate> ();
            mBodyLookup     = new Dictionary <string, CreatureBody> ();
        }
コード例 #2
0
        public IEnumerator PlayCutsceneOverTime()
        {
            double start = Frontiers.WorldClock.AdjustedRealTime;

            while (Frontiers.WorldClock.AdjustedRealTime < start + State.InitialDelay)
            {
                yield return(null);
            }
            //get the creature body - we're only using a shell here
            CreatureBody     body     = null;
            CreatureTemplate template = null;
            AnimationClip    clip     = null;

            if (Creatures.GetBody(State.CreatureBodyName, out body))
            {
                if (Creatures.GetCutsceneClip(State.CutsceneClipName, out clip))
                {
                    //create the base object and add the animation
                    //parent it under this trigger
                    CreatureCutsceneObject    = gameObject.CreateChild(State.Name + " - " + State.CreatureBodyName).gameObject;
                    CreatureCutsceneAnimation = CreatureCutsceneObject.AddComponent <Animation>();
                    CreatureCutsceneAnimation.AddClip(clip, State.CutsceneClipName);
                    //this script will implement the IBodyOwner interface
                    UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(CreatureCutsceneObject, "Assets/Scripts/GameWorld/Triggers/TriggerCreatureCutscene.cs (46,11)", State.CutsceneScriptName);
                    IBodyOwner bodyOwner = CreatureCutsceneObject.GetComponent(typeof(IBodyOwner)) as IBodyOwner;
                    //create an empty body shell
                    GameObject creatureCutsceneBodyObject = GameObject.Instantiate(body.gameObject, transform.position, Quaternion.identity) as GameObject;
                    CreatureCutsceneBody       = creatureCutsceneBodyObject.GetComponent <CreatureBody>();
                    CreatureCutsceneBody.Owner = bodyOwner;
                    bodyOwner.Body             = CreatureCutsceneBody;
                    //and we're off!
                    CreatureCutsceneAnimation.Play(State.CutsceneClipName, PlayMode.StopAll);
                }
            }

            while (CreatureCutsceneObject != null)
            {
                yield return(null);
            }

            GameObject.Destroy(CreatureCutsceneBody.gameObject);

            mPlayingCutscene = false;

            Missions.Get.ChangeVariableValue(State.MissionVariableMissionName, State.MissionVariableVariableName, State.MissionVariableChangeValue, State.MissionVariableChangeType);

            yield break;
        }