Exemplo n.º 1
0
        protected IEnumerator SleepingOverTime(Bed bed)
        {
            //first go to the bed sleep point
            //TODO make this a motile action
            worlditem.tr.position = bed.SleepingPosition;
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                mSleepAction.Reset();
                mSleepAction.IdleAnimation = GameWorld.Get.FlagByName("IdleAnimation", "Sleeping");
                motile.PushMotileAction(mSleepAction, MotileActionPriority.ForceTop);
                //let them sleep zzzzz
                yield return(mSleepAction.WaitForActionToFinish(0.25f));

                //once we wake up, if the bed is not null
                //clear its occupant!
                if (bed != null)
                {
                    bed.Occupant = null;
                }
            }
            mIsSleeping = false;
            yield break;
        }
Exemplo n.º 2
0
        protected void OnCharacterEnter(Character character, Motile motile)
        {
            if (State.Users == ActionNodeUsers.SpecifiedOccupantOnly &&
                character.worlditem.FileName != State.OccupantName)
            {
                return;
            }

            //if we're supposed to tell characters to occupy on enter
            //and if we don'
            //and if the character is not the current occupant
            if (State.TryToOccupyOnEnter &&
                !(State.TryToOccupyOnce && State.NumTimesOccupied > 0) &&
                mOccupant != character.worlditem)                                       //make sure we should try to enter first
            //if it's the right character, wuhoo!
            {
                MotileAction newAction = new MotileAction();
                newAction.Type       = MotileActionType.GoToActionNode;
                newAction.Target     = new MobileReference(State.Name, State.ParentGroupPath);
                newAction.LiveTarget = this;
                newAction.Expiration = MotileExpiration.TargetOutOfRange;
                if (State.UseTrigger)                                   //keep the range smaller so we get to the middle
                {
                    newAction.Range = 2.5f;                             //TODO kludge
                }
                else                                                    //use the standard minimum range
                {
                    newAction.Range = mMinimumRadius;
                }
                newAction.OutOfRange = State.TriggerRadius * 2.0f;
                motile.PushMotileAction(newAction, MotileActionPriority.ForceTop);
            }
        }
Exemplo n.º 3
0
        public void OnPlayerEncounter()
        {
            if (character.IsDead || character.IsStunned || character.IsSleeping)
            {
                return;
            }

            if (State.DTSOnPlayerEncounter && !string.IsNullOrEmpty(State.DTSSpeechName))
            {
                Motile motile = null;
                if (worlditem.Is <Motile> (out motile))                  //get the listener target = use focus object
                //send a motile action to keep the character in place
                //the FocusObject will be moved around by the speech bubble each page
                {
                    if (mSpeechMotileAction == null)
                    {
                        mSpeechMotileAction = new MotileAction();
                    }
                    mSpeechMotileAction.Reset();
                    mSpeechMotileAction.Type          = MotileActionType.FocusOnTarget;
                    mSpeechMotileAction.Expiration    = MotileExpiration.Never;
                    mSpeechMotileAction.YieldBehavior = MotileYieldBehavior.YieldAndFinish;
                    mSpeechMotileAction.IdleAnimation = GameWorld.Get.FlagByName("IdleAnimation", "Talking");
                    mSpeechMotileAction.LiveTarget    = Player.Local;
                    //we want normal because we want to reach the action node first
                    motile.PushMotileAction(mSpeechMotileAction, MotileActionPriority.Next);
                }
                GiveSpeech(State.DTSSpeechName, null);
            }
        }
Exemplo n.º 4
0
        public void Stalk()
        {
            if (!mWatchAction.IsFinished)
            {
                mWatchAction.TryToFinish();
            }
            Mode = HostileMode.Stalking;
            //start stalking our target
            mStalkAction.Reset();
            mStalkAction.TerritoryBase = TerritoryBase;
            mStalkAction.LiveTarget    = mPrimaryTarget;
            mStalkAction.Type          = MotileActionType.FollowTargetHolder;
            mStalkAction.Method        = MotileGoToMethod.Pathfinding;
            mStalkAction.FollowType    = MotileFollowType.Stalker;
            mStalkAction.Expiration    = MotileExpiration.Duration;
            mStalkAction.YieldBehavior = MotileYieldBehavior.YieldAndWait;
            mStalkAction.RTDuration    = State.StalkTime;

            motile.PushMotileAction(mStalkAction, MotileActionPriority.ForceTop);

            OnStalk.SafeInvoke();
        }
Exemplo n.º 5
0
        protected IEnumerator StartSpeech(DispatchedSpeech speech)
        {
            if (speech.speech == null)
            {
                Debug.Log("Speech is null, breaking");
            }

            State.LastSpeechName    = speech.speech.Name;
            State.LastSpeechStarted = WorldClock.AdjustedRealTime;
            State.LastSpeechPage    = -1;

            speech.speech.StartSpeech(worlditem.FileName);
            Mods.Get.Runtime.SaveMod <Speech> (speech.speech, "Speech", speech.speech.Name);
            //send motile action
            Transform listenerTarget = null;
            Motile    motile         = null;

            Debug.Log("Giving speech over time in character...");
            if (worlditem.Is <Motile> (out motile))              //get the listener target = use focus object
            {
                listenerTarget = motile.GoalObject;
                //send a motile action to keep the character in place
                //the FocusObject will be moved around by the speech bubble each page
                if (mSpeechMotileAction == null)
                {
                    mSpeechMotileAction = new MotileAction();
                }
                mSpeechMotileAction.Reset();
                mSpeechMotileAction.Type       = MotileActionType.FocusOnTarget;
                mSpeechMotileAction.Expiration = MotileExpiration.Never;
                if (speech.speech.CanBeInterrupted)                     //if we can be interrupted, let the speech cut off
                {
                    mSpeechMotileAction.YieldBehavior = MotileYieldBehavior.YieldAndFinish;
                }
                else                            //if it can't be interrupted, do not yield to other actions
                {
                    mSpeechMotileAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                }
                mSpeechMotileAction.IdleAnimation = GameWorld.Get.FlagByName("IdleAnimation", "Talking");
                //we want normal because we want to reach the action node first
                motile.PushMotileAction(mSpeechMotileAction, MotileActionPriority.Next);
            }
            else
            {
                listenerTarget = worlditem.tr;
            }

            //create speech bubble
            mSpeechBubble = CreateSpeechBubble(speech.speech, speech.dispatcher, listenerTarget);
            yield break;
        }
Exemplo n.º 6
0
        public MotileAction WatchThingAction(IItemOfInterest itemOfInterest)
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFocusAction.IsFinished || mFocusAction.LiveTarget != itemOfInterest)
                {
                    mFocusAction.Reset();
                    mFocusAction.LiveTarget = itemOfInterest;
                    motile.PushMotileAction(mFocusAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFocusAction);
        }
Exemplo n.º 7
0
        public MotileAction FollowThingAction(IItemOfInterest itemOfInterest)
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFollowAction.State == MotileActionState.NotStarted || mFollowAction.IsFinished || mFollowAction.LiveTarget != itemOfInterest)
                {
                    mFollowAction.Reset();
                    mFollowAction.LiveTarget = itemOfInterest;
                    motile.PushMotileAction(mFollowAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFollowAction);
        }
Exemplo n.º 8
0
        public MotileAction WatchThingAction(IItemOfInterest itemOfInterest)
        {
            //if the creature is idle, turn to look at the player
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFocusAction.State == MotileActionState.NotStarted || mFocusAction.IsFinished || mFocusAction.LiveTarget != itemOfInterest)
                {
                    mFocusAction.Reset();
                    mFocusAction.LiveTarget = itemOfInterest;
                    motile.PushMotileAction(mFocusAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFocusAction);
        }
Exemplo n.º 9
0
        public MotileAction GoToThing(IItemOfInterest itemOfInterest)
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mPursueGoalAction.IsFinished || mPursueGoalAction.LiveTarget != itemOfInterest || itemOfInterest == null)
                {
                    mPursueGoalAction.Reset();
                    mPursueGoalAction.LiveTarget    = itemOfInterest;
                    mPursueGoalAction.TerritoryBase = TerritoryBase;                    //null typically
                    motile.PushMotileAction(mPursueGoalAction, MotileActionPriority.ForceTop);
                }
            }
            return(mPursueGoalAction);
        }
Exemplo n.º 10
0
        public MotileAction FollowThingAction(IItemOfInterest itemOfInterest)
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFollowAction.IsFinished || mFollowAction.LiveTarget != itemOfInterest)
                {
                    mFollowAction.Reset();
                    mFollowAction.LiveTarget    = itemOfInterest;
                    mFollowAction.TerritoryBase = TerritoryBase;                    //null typically
                    motile.PushMotileAction(mFollowAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFollowAction);
        }
Exemplo n.º 11
0
        public MotileAction FleeFromThingAction(IItemOfInterest itemOfInterest)
        {
            Body.EyeMode = BodyEyeMode.Timid;
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFleeThreatAction.State == MotileActionState.NotStarted || mFleeThreatAction.IsFinished || mFleeThreatAction.LiveTarget != itemOfInterest)
                {
                    mFleeThreatAction.Reset();
                    mFleeThreatAction.LiveTarget    = itemOfInterest;
                    mFleeThreatAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    motile.PushMotileAction(mFleeThreatAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFleeThreatAction);
        }
Exemplo n.º 12
0
        public MotileAction FleeFromPlayer()
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFleeThreatAction.IsFinished || mFleeThreatAction.LiveTarget != Player.Local)
                {
                    mFleeThreatAction.Reset();
                    mFleeThreatAction.LiveTarget    = Player.Local;
                    mFleeThreatAction.Range         = 10f;
                    mFleeThreatAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    motile.PushMotileAction(mFleeThreatAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFleeThreatAction);
        }
Exemplo n.º 13
0
        public MotileAction FleeFromThingAction(IItemOfInterest itemOfInterest)
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mFleeThreatAction.IsFinished || mFleeThreatAction.LiveTarget != itemOfInterest)
                {
                    mFleeThreatAction.Reset();
                    mFleeThreatAction.LiveTarget    = itemOfInterest;
                    mFleeThreatAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    mFleeThreatAction.TerritoryBase = TerritoryBase;                    //null typically
                    motile.PushMotileAction(mFleeThreatAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFleeThreatAction);
        }
Exemplo n.º 14
0
        public MotileAction ReturnToDenInnerRadius()
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mReturnToDenAction.IsFinished)
                {
                    mReturnToDenAction.Reset();
                    mReturnToDenAction.Expiration    = MotileExpiration.TargetInRange;
                    mReturnToDenAction.Range         = Den.InnerRadius;
                    mReturnToDenAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    motile.PushMotileAction(mReturnToDenAction, MotileActionPriority.ForceTop);
                }
            }
            return(mReturnToDenAction);
        }
Exemplo n.º 15
0
        public MotileAction WanderAction()
        {
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mWanderAction == null)
                {
                    mWanderAction = motile.BaseAction;
                }
                if (mWanderAction.State == MotileActionState.NotStarted || mWanderAction.IsFinished)
                {
                    mWanderAction.Reset();
                    motile.PushMotileAction(mWanderAction, MotileActionPriority.ForceBase);
                }
            }
            return(mWanderAction);
        }
Exemplo n.º 16
0
        public MotileAction EatThingAction(IItemOfInterest itemOfInterest)
        {
            mLastThingTryToEat = itemOfInterest;
            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mEatAction.State == MotileActionState.NotStarted || mEatAction.IsFinished || mEatAction.LiveTarget != itemOfInterest)
                {
                    mEatAction.Reset();
                    mEatAction.LiveTarget      = itemOfInterest;
                    mEatAction.Range           = Template.MotileTemplate.MotileProps.RVORadius;
                    mEatAction.YieldBehavior   = MotileYieldBehavior.DoNotYield;
                    mEatAction.OnFinishAction += OnReachThingToEat;
                    motile.PushMotileAction(mEatAction, MotileActionPriority.ForceTop);
                }
            }
            return(mEatAction);
        }
Exemplo n.º 17
0
        public bool SuspendGuard()
        {
            if (!FindGuardNode())
            {
                BarrierCollider.enabled = false;
                return(false);
            }
            if (!FindSuccessNode())
            {
                BarrierCollider.enabled = false;
                return(false);
            }
            if (!FindGuardCharacter())
            {
                BarrierCollider.enabled = false;
                return(false);
            }

            Motile motile = null;

            if (GuardCharacter.worlditem.Is <Motile> (out motile))
            {
                GuardNode.VacateNode(GuardCharacter.worlditem);
                MotileAction goToNodeAction = MotileAction.GoTo(SuccessNode.State);
                motile.PushMotileAction(goToNodeAction, MotileActionPriority.ForceTop);
            }
            //do this second so the guard occupies the node first, then pays attention to the player
            if (!string.IsNullOrEmpty(State.DTSOnSuccess))
            {
                Talkative talkative = null;
                if (GuardCharacter.worlditem.Is <Talkative> (out talkative))
                {
                    Speech dts = null;
                    if (Mods.Get.Runtime.LoadMod <Speech> (ref dts, "Speech", State.DTSOnSuccess))
                    {
                        talkative.SayDTS(dts);
                    }
                }
            }
            BarrierCollider.enabled           = false;
            GetComponent <Collider>().enabled = false;
            return(true);
        }
Exemplo n.º 18
0
        public MotileAction FleeFromLight()
        {
            Body.EyeMode = BodyEyeMode.Scared;
            Motile motile = null;

            if (photosensitive.HasNearbyLights && worlditem.Is <Motile> (out motile))
            {
                WorldLight nearestLight = photosensitive.NearestLight;
                if (mFleeThreatAction.IsFinished || mFleeThreatAction.LiveTarget != nearestLight)
                {
                    mFleeThreatAction.Reset();
                    mFleeThreatAction.LiveTarget    = nearestLight;
                    mFleeThreatAction.Range         = nearestLight.TargetBaseRange;
                    mFleeThreatAction.OutOfRange    = nearestLight.TargetBaseRange + 1f;
                    mFleeThreatAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    motile.PushMotileAction(mFleeThreatAction, MotileActionPriority.ForceTop);
                }
            }
            return(mFleeThreatAction);
        }
Exemplo n.º 19
0
        protected override bool OnCharacterEnter(Character character)
        {
            Motile motile = null;

            if (character.worlditem.Is <Motile>(out motile))
            {
                if (State.ClearActions)
                {
                    motile.StopMotileActions();
                }
                MotileAction newMotileAction = ObjectClone.Clone <MotileAction>(State.Action);
                if (State.SequenceNodes)
                {
                    string targetName = newMotileAction.Target.FileName.Replace("[#]", State.NumTimesTriggered.ToString());
                    newMotileAction.Target.FileName = targetName;
                }
                motile.PushMotileAction(newMotileAction, State.Priority);
                return(true);
            }

            return(false);
        }
Exemplo n.º 20
0
        public MotileAction ReturnToDen()
        {
            if (mReturnToDenAction == null)
            {
                return(null);
            }

            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                if (mReturnToDenAction.IsFinished)
                {
                    mReturnToDenAction.Reset();
                    mReturnToDenAction.Range         = Den.Radius;
                    mReturnToDenAction.LiveTarget    = Den.IOI;
                    mReturnToDenAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                    motile.PushMotileAction(mReturnToDenAction, MotileActionPriority.ForceTop);
                }
            }
            return(mReturnToDenAction);
        }
Exemplo n.º 21
0
        public void HearCommand(SpeechBubble audibleSpeech, string command)
        {
            if (audibleSpeech.Speaker.worlditem == worlditem)                   //can't react to your own speeches
            {
                return;
            }

            Motile motile = null;

            if (worlditem.Is <Motile> (out motile))
            {
                MotileAction topAction = motile.TopAction;
                MotileAction newAction = new MotileAction();
                newAction.Target     = new MobileReference(audibleSpeech.Speaker.worlditem.FileName, audibleSpeech.Speaker.worlditem.Group.Props.PathName);
                newAction.LiveTarget = audibleSpeech.Speaker.worlditem;
                MotileActionPriority priority = MotileActionPriority.ForceTop;

                switch (command)
                {
                case "Listen":
                    FXManager.Get.SpawnFX(motile.Body.Transforms.HeadTop, "ListenEffect");
                    if (!IsListeningTo(audibleSpeech))
                    {
                        if (topAction.Type == MotileActionType.GoToActionNode)
                        {
                            priority = MotileActionPriority.Next;
                        }
                        ////Debug.Log ("Listener is listening to speaker " + audibleSpeech.Speaker.name);
                        if (mListenAction == null)
                        {
                            mListenAction = new MotileAction();
                        }
                        mListenAction.Type          = MotileActionType.FocusOnTarget;
                        mListenAction.Expiration    = MotileExpiration.TargetOutOfRange;
                        mListenAction.OutOfRange    = audibleSpeech.ParentSpeech.AudibleRange * 2.0f;
                        mListenAction.Target        = new MobileReference(audibleSpeech.Speaker.worlditem.FileName, audibleSpeech.Speaker.worlditem.Group.Props.PathName);
                        mListenAction.LiveTarget    = audibleSpeech.Speaker.worlditem;
                        mListenAction.YieldBehavior = MotileYieldBehavior.YieldAndFinish;
                        motile.PushMotileAction(mListenAction, priority);
                    }
                    break;

                case "FollowSpeaker":
                    if (!IsFollowing(audibleSpeech))
                    {
                        //Debug.Log ("Listener is following speaker " + audibleSpeech.Speaker.name);
                        if (mFollowAction == null)
                        {
                            mFollowAction = new MotileAction();
                        }
                        mFollowAction.Type          = MotileActionType.FollowTargetHolder;
                        mFollowAction.LiveTarget    = audibleSpeech.Speaker.worlditem;
                        mFollowAction.Target        = new MobileReference(audibleSpeech.Speaker.worlditem.FileName, audibleSpeech.Speaker.worlditem.Group.Props.PathName);
                        mFollowAction.Expiration    = MotileExpiration.Duration;
                        mFollowAction.RTDuration    = 600.0f;
                        mFollowAction.YieldBehavior = MotileYieldBehavior.DoNotYield;
                        motile.PushMotileAction(mFollowAction, priority);
                    }
                    break;

                case "StopListeningAndFollowing":
                    if (IsListeningTo(audibleSpeech))
                    {
                        mListenAction.TryToFinish();
                    }
                    if (IsFollowing(audibleSpeech))
                    {
                        mFollowAction.TryToFinish();
                    }
                    break;

                case "StopListening":
                    if (IsListeningTo(audibleSpeech))
                    {
                        mListenAction.TryToFinish();
                    }
                    break;

                case "StopFollowing":
                    if (IsFollowing(audibleSpeech))
                    {
                        mFollowAction.TryToFinish();
                    }
                    break;

                case "LookAtPlayer":
                    FXManager.Get.SpawnFX(motile.Body.Transforms.HeadTop, "ListenEffect", UnityEngine.Random.value * 3f);
                    worlditem.Get <Character> ().LookAtPlayer();
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 22
0
        protected IEnumerator FollowPathOverTime()
        {
            //create the motile action and push it first
            yield return(null);

            if (mFollowPathAction == null)
            {
                mFollowPathAction               = new MotileAction();
                mFollowPathAction.Type          = MotileActionType.FollowGoal;
                mFollowPathAction.Expiration    = MotileExpiration.Never;
                mFollowPathAction.YieldBehavior = MotileYieldBehavior.YieldAndWait;
                mFollowPathAction.LiveTarget    = this;
                mFollowPathAction.Range         = 2f;
                mFollowPathAction.OutOfRange    = 100f;
                mFollowPathAction.Name          = "PilgrimFollowPath";
            }
            else
            {
                mFollowPathAction.Reset();
            }

            Motile motile = worlditem.Get <Motile>();

            motile.PushMotileAction(mFollowPathAction, MotileActionPriority.ForceTop);
            State.PathMode = FollowPathMode.FollowingPath;

            yield return(null);

            while (State.PathMode != FollowPathMode.None)                                       //check the state of the motile action we submitted
            {
                switch (mFollowPathAction.State)
                {
                case MotileActionState.Started:
                case MotileActionState.Starting:
                    //hooray, it has started, update the path
                    //set it to reached pilgrim stop to force us to go to the next stop
                    var updateFollowPath = UpdateFollowPath();
                    while (updateFollowPath.MoveNext())
                    {
                        yield return(updateFollowPath.Current);
                    }
                    //now see if the path has finished or whatever
                    switch (State.PathMode)
                    {
                    case FollowPathMode.None:
                        //case FollowPathMode.ReachedEndOfPath:
                        //hooray we're done
                        //yield return StartCoroutine(FinishFollowingPath());
                        break;

                    default:
                        //keep going
                        //this includes waiting for an obstruction
                        break;
                    }
                    break;

                case MotileActionState.Error:
                case MotileActionState.Finished:
                    //whoops, we're done on the Motile end for some reason
                    //maybe we're dead or maybe we got a conflicting command
                    yield return(StartCoroutine(FinishFollowingPath()));

                    break;

                case MotileActionState.Waiting:
                    //we're being talked to or something, just hang out
                    break;

                default:
                    break;
                }
                //wait for a bit
                yield return(gWaitForFollowPath);
            }
            mFollowingPathOverTime = false;
            yield break;
        }
Exemplo n.º 23
0
        public bool ResumeGuard(bool sayDTS)
        {
            if (!FindGuardNode())
            {
                Debug.Log("Couldn't find guard node");
                BarrierCollider.enabled = false;
                return(false);
            }
            if (!FindSuccessNode())
            {
                Debug.Log("Couldn't find success node");
                BarrierCollider.enabled = false;
                return(false);
            }
            if (!FindGuardCharacter())
            {
                Debug.Log("Couldn't find guard");
                BarrierCollider.enabled = false;
                return(false);
            }

            if (GuardCharacter.IsStunned || GuardCharacter.IsSleeping || GuardCharacter.IsDead)
            {
                Debug.Log("Guard is stunned, sleeping or dead");
                BarrierCollider.enabled = false;
                return(true);
            }

            //Debug.Log ("Player isn't wearing uniform");
            if (!GuardNode.HasOccupant)
            {
                Motile motile = null;
                if (GuardCharacter.worlditem.Is <Motile> (out motile))
                {
                    GuardNode.VacateNode(SuccessNode.worlditem);
                    MotileAction goToNodeAction = MotileAction.GoTo(GuardNode.State);
                    motile.PushMotileAction(goToNodeAction, MotileActionPriority.ForceTop);
                }
            }
            else
            {
                GuardCharacter.LookAtPlayer();
            }
            GuardCharacter.worlditem.GetOrAdd <Guard> ();
            //do this second so the guard occupies the node first, then pays attention to the player
            if (sayDTS && !string.IsNullOrEmpty(State.DTSOnFailure))
            {
                Talkative talkative = null;
                if (GuardCharacter.worlditem.Is <Talkative> (out talkative))
                {
                    Speech dts = null;
                    if (Mods.Get.Runtime.LoadMod <Speech> (ref dts, "Speech", State.DTSOnFailure))
                    {
                        talkative.SayDTS(dts);
                    }
                }
            }

            bool isOnBarrierSide = false;
            //use the node + barrier to determine direction
            Vector3 barrierPosition = BarrierCollider.bounds.center;

            barrierPosition.y = Player.Local.Position.y;
            Vector3 barrierDirection = (GuardNode.Position - barrierPosition).normalized;
            Vector3 playerDirection  = (Player.Local.Position - barrierPosition).normalized;
            float   dot = Vector3.Dot(barrierDirection, playerDirection);

            Debug.Log("Dot: " + dot.ToString());
            if (dot < 0f)
            {
                isOnBarrierSide = true;
            }

            //push the player away
            if (State.PushPlayer)
            {
                Player.Local.Audio.GetPushed();
                if (isOnBarrierSide && State.EjectFromOppositeEnd)
                {
                    mMovingPlayerToOtherSide = true;
                    StartCoroutine(MovePlayerToOtherSide());
                }
                else
                {
                    Player.Local.FPSController.AddForce(Vector3.Normalize(GuardCharacter.worlditem.Position - Player.Local.Position) * -0.1f);
                }
            }
            BarrierCollider.enabled           = true;
            GetComponent <Collider>().enabled = true;
            return(true);
        }