예제 #1
0
 public void UnChargePortal()
 {
     this.State = TimePortal.PortalState.Active;
 }
예제 #2
0
 public void UpdateState(TimePortal.PortalState newState)
 {
     this.UpdateState(newState, false);
 }
예제 #3
0
        public void UpdateState(TimePortal.PortalState newState, bool fromFixUp)
        {
            if (this.State == newState && !fromFixUp)
            {
                return;
            }
            this.StopActiveFX();
            switch (newState)
            {
            case TimePortal.PortalState.Active:
                this.mActiveFX = VisualEffect.Create("ep11Portal_main");
                this.mActiveFX.SetUseBoneParenting(true);
                this.mActiveFX.ParentTo(this, TimePortal.kEffectSlot);
                this.mActiveFX.Start();
                if (this.State == TimePortal.PortalState.Inactive)
                {
                    this.AddActivateAlarm();
                }
                this.RemoveUnstableAlarm();
                this.RemoveChargedAlarm();
                break;

            case TimePortal.PortalState.Charged:
                this.mActiveFX = VisualEffect.Create("ep11PortalCharged_main");
                this.mActiveFX.SetUseBoneParenting(true);
                this.mActiveFX.ParentTo(this, TimePortal.kEffectSlot);
                this.mActiveFX.Start();
                this.AddChargedAlarm();
                this.RemoveUnstableAlarm();
                break;

            case TimePortal.PortalState.Unstable:
                this.mActiveFX = VisualEffect.Create("ep11PortalUnstable_main");
                this.mActiveFX.SetUseBoneParenting(true);
                this.mActiveFX.ParentTo(this, TimePortal.kEffectSlot);
                this.mActiveFX.Start();
                this.AddUnstableAlarm();
                this.RemoveChargedAlarm();
                break;

            case TimePortal.PortalState.Rainbow:
                this.mActiveFX = VisualEffect.Create("ep11PortalRainbow_main");
                this.mActiveFX.SetUseBoneParenting(true);
                this.mActiveFX.ParentTo(this, TimePortal.kEffectSlot);
                this.mActiveFX.Start();
                if (this.State == TimePortal.PortalState.Inactive)
                {
                    this.AddActivateAlarm();
                }
                this.RemoveUnstableAlarm();
                this.RemoveChargedAlarm();
                break;

            case TimePortal.PortalState.Distopia:
                this.mActiveFX = VisualEffect.Create("ep11PortalDystopia_main");
                this.mActiveFX.SetUseBoneParenting(true);
                this.mActiveFX.ParentTo(this, TimePortal.kEffectSlot);
                this.mActiveFX.Start();
                if (this.State == TimePortal.PortalState.Inactive)
                {
                    this.AddActivateAlarm();
                }
                this.RemoveUnstableAlarm();
                this.RemoveChargedAlarm();
                break;

            default:
                this.RemoveUnstableAlarm();
                this.RemoveChargedAlarm();
                this.InactivePortalGeometry();
                break;
            }
            this.mCurState = newState;
        }
예제 #4
0
        public override bool Run()
        {
            try
            {
                IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition;

                if (Target.IsBroken)
                {
                    return(false);
                }

                int num;
                if (mIsMaster)
                {
                    if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!Actor.RouteToSlotList(Target, TimePortal.kRoutingSlots, out num))
                    {
                        return(false);
                    }
                }

                if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    return(false);
                }

                StandardEntry();

                EnterStateMachine("timeportal", "Enter", "x", "portal");
                AddPersistentScriptEventHandler(0xc9, CameraShakeEventEx);

                if (mIsMaster && !Actor.HasExitReason())
                {
                    TimePortalWooHoo entry = definition.ProxyClone(Actor).CreateInstance(Target, mWoohooee, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true) as TimePortalWooHoo;
                    entry.LinkedInteractionInstance = this;
                    entry.mWoohooee = mWoohooee;
                    mWoohooee.InteractionQueue.AddNext(entry);
                }

                Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future);
                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Jump In");
                }
                else
                {
                    AnimateSim("Apprehensive");
                }

                bool succeeded = true;

                if (StartSync(mIsMaster))
                {
                    BeginCommodityUpdates();

                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo);

                    if (mIsMaster)
                    {
                        CommonWoohoo.TestNakedOutfit(Woohooer.Settings.mNakedOutfitTimePortal, Actor, mWoohooee);

                        TimePortal.PortalState previousState = Target.State;

                        List <TimePortal.PortalState> choices = new List <TimePortal.PortalState>();
                        foreach (TimePortal.PortalState state in Enum.GetValues(typeof(TimePortal.PortalState)))
                        {
                            if (state == TimePortal.PortalState.Invalid_State)
                            {
                                continue;
                            }

                            choices.Add(state);
                        }

                        int count = 0;
                        while (Target.ActorsUsingMe.Contains(mWoohooee))
                        {
                            TimePortalWooHoo interaction = LinkedInteractionInstance as TimePortalWooHoo;
                            if (interaction == null)
                            {
                                break;
                            }

                            if (mWoohooee.HasExitReason(ExitReason.Canceled))
                            {
                                break;
                            }

                            if (mIsMaster)
                            {
                                if (count > 30)
                                {
                                    break;
                                }
                                count++;

                                Target.UpdateState(RandomUtil.GetRandomObjectFromList(choices));

                                if (RandomUtil.RandomChance(5))
                                {
                                    CameraShakeEventEx(null, null);
                                }
                            }

                            SpeedTrap.Sleep(10);
                        }

                        CommonWoohoo.RunPostWoohoo(Actor, mWoohooee, Target, definition.GetStyle(this), definition.GetLocation(Target), true);

                        Target.UpdateState(previousState);
                    }
                    else
                    {
                        do
                        {
                            SpeedTrap.Sleep(0xa);
                        }while (Target.UseCount > 0x1);
                    }

                    RockGemMetalBase.HandleNearbyWoohoo(Actor, RockGemMetalBase.HowMuchWooHoo.LessWoohoo);
                }
                else if (mIsMaster)
                {
                    if (LinkedInteractionInstance != null)
                    {
                        LinkedInteractionInstance.InstanceActor.AddExitReason(ExitReason.CanceledByScript);
                    }
                }

                if (((succeeded && Actor.TraitManager.HasElement(TraitNames.Unstable)) && (!Actor.BuffManager.HasElement(BuffNames.FeelingOutOfSorts) && !Actor.BuffManager.HasElement(BuffNames.ImpendingEpisode))) && (!Actor.BuffManager.HasElement(BuffNames.Delusional) && RandomUtil.RandomChance01(kUnstableTraitChance)))
                {
                    Actor.BuffManager.AddElement(BuffNames.FeelingOutOfSorts, Origin.FromUnstableTrait);
                }

                if (futureSkill.SkillLevel >= 0x3)
                {
                    AnimateSim("Exit");
                }
                else
                {
                    AnimateSim("Spit Out");
                }

                EndCommodityUpdates(succeeded);
                StandardExit();

                if (!mIsMaster)
                {
                    if (CommonPregnancy.IsSuccess(Actor, mWoohooee, Autonomous, definition.GetStyle(this)))
                    {
                        CommonPregnancy.Impregnate(Actor, mWoohooee, Autonomous, definition.GetStyle(this));
                    }

                    Actor.RouteAway(1f, 3f, false, GetPriority(), Autonomous, false, true, RouteDistancePreference.PreferNearestToRouteOrigin);
                }
                else
                {
                    Target.StopActiveFX();
                }

                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }