示例#1
0
        public override bool Run()
        {
            try
            {
                StateMachineClient client = StateMachineClient.Acquire(Actor, "single_animation");
                client.SetActor("x", Actor);
                client.EnterState("x", "Enter");

                Definition definition = InteractionDefinition as Definition;

                Sim.AnimationClipDataForCAS rcas = definition.mAnimation;

                while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                {
                    if (!AnimationTone.ControlLoop(this))
                    {
                        break;
                    }

                    client.SetParameter("AnimationClip", rcas.AnimationClipName, rcas.ProductVersion);
                    client.RequestState("x", "Animate");
                    client.RequestState(false, "x", "Enter");
                }
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
            }
            return(false);
        }
 public void Looped(StateMachineClient smc, IEvent evt)
 {
     if (!AnimationTone.ControlLoop(this))
     {
         Target.AddExitReason(ExitReason.Finished);
     }
 }
示例#3
0
        public override bool Run()
        {
            try
            {
                IdleInfo info = (InteractionDefinition as Definition).Idle;
                bool     flag = Actor.Posture.Satisfies(CommodityKind.Sitting, null);
                if (!string.IsNullOrEmpty(info.CustomJazzGraph))
                {
                    while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                    {
                        if (!AnimationTone.ControlLoop(this))
                        {
                            break;
                        }

                        Sim.CustomIdle idle = Sim.CustomIdle.Singleton.CreateInstance(Actor, Actor, GetPriority(), true, true) as Sim.CustomIdle;
                        idle.Hidden        = true;
                        idle.JazzGraphName = info.CustomJazzGraph;
                        idle.LoopTimes     = info.PickCustomJazzGraphLoopCount();
                        idle.ExtraWaitTime = info.CasOnly ? 0x78 : 0x0;
                        if (idle.JazzGraphName == "TraitWorkaholic")
                        {
                            idle.IdleObject = Actor.Inventory.Find <IPhoneCell>() as GameObject;
                            idle.ObjectName = "phonecell";
                        }
                        idle.RunInteraction();
                    }
                }
                else
                {
                    string animationName = null;
                    if (flag)
                    {
                        animationName = info.SeatedAnimationName;
                    }
                    if (string.IsNullOrEmpty(animationName))
                    {
                        animationName = info.AnimationName;
                    }

                    while (!Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)))
                    {
                        if (!AnimationTone.ControlLoop(this))
                        {
                            break;
                        }

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