コード例 #1
0
ファイル: Kill.cs プロジェクト: pepoluan/NRaas
            public MeteorControl(Sim actor, Sim target)
                : base(15, TimeUnit.Minutes)
            {
                mActor  = actor;
                mTarget = target;

                Vector3 empty = Vector3.Empty;
                Vector3 fwd   = Vector3.Empty;
                Jig     jig   = GlobalFunctions.CreateObject("MeteorImpactJig", ProductVersion.EP2, Vector3.OutOfWorld, 0x0, Vector3.UnitZ, "Sims3.Gameplay.Core.Jig", null) as Jig;

                FindGoodLocationBooleans booleans = FindGoodLocationBooleans.AllowOnBridges | FindGoodLocationBooleans.AllowOnSideWalks | FindGoodLocationBooleans.AllowOnStreets | FindGoodLocationBooleans.TemporaryPlacement;

                World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(target.PositionOnFloor);
                fglParams.BooleanConstraints = booleans;
                fglParams.PlacementCheckFunc = Sims3.Gameplay.Objects.Miscellaneous.Meteor.IsValidMeteorPosition;
                if (GlobalFunctions.FindGoodLocation(jig, fglParams, out empty, out fwd))
                {
                    mMeteor = GlobalFunctions.CreateObject("MeteorImpactShadow", ProductVersion.EP2, empty, 0x0, fwd, "Sims3.Gameplay.Objects.Miscellaneous.Meteor", null) as Sims3.Gameplay.Objects.Miscellaneous.Meteor;
                    mMeteor.SetHiddenFlags(HiddenFlags.Footprint);
                }

                jig.Destroy();

                if ((actor != null) && (mMeteor != null))
                {
                    mTarget.InteractionQueue.AddNext(Sims3.Gameplay.Objects.Miscellaneous.Meteor.ReactToMeteor.Singleton.CreateInstance(mMeteor, mTarget, mTarget.InheritedPriority(), false, true));

                    mActor.InteractionQueue.CancelAllInteractions();

                    Vector3 position      = actor.Position;
                    Vector3 forwardVector = actor.ForwardVector;
                    if (GlobalFunctions.FindGoodLocationNearby(actor, ref position, ref forwardVector, Sims3.Gameplay.Objects.Miscellaneous.Meteor.kMeteorBlastZoneRadius, GlobalFunctions.FindGoodLocationStrategies.All, FindGoodLocationBooleans.None))
                    {
                        InteractionInstance interaction = Terrain.GoHere.GetSingleton(actor, position).CreateInstanceWithCallbacks(Terrain.Singleton, actor, new InteractionPriority(InteractionPriorityLevel.UserDirected), true, true, null, null, OnGoHereFailure);

                        interaction.RequestWalkStyle(Sim.WalkStyle.Run);

                        actor.InteractionQueue.AddNext(interaction);
                    }
                    else
                    {
                        mActor.InteractionQueue.AddNext(Sims3.Gameplay.Objects.Miscellaneous.Meteor.ReactToMeteor.Singleton.CreateInstance(mMeteor, mActor, mActor.InheritedPriority(), false, true));
                    }
                }
            }