コード例 #1
0
ファイル: EWChaseOffLot.cs プロジェクト: Echoweaver/Sims3Game
            public override InteractionInstance CreateInstance(ref InteractionInstanceParameters parameters)
            {
                ChaseBaseClass chaseBaseClass = new EWChaseOffLot();

                chaseBaseClass.Init(ref parameters);
                chaseBaseClass.IsMeanChase = true;
                return(chaseBaseClass);
            }
コード例 #2
0
ファイル: EWChaseOffLot.cs プロジェクト: Echoweaver/Sims3Game
        public override void RunPostChaseBehavior()
        {
            skillActor.StartSkillGain(EWPetFightingSkill.kSkillGainRateNormal);
            OutcomeType outcomeType = OutcomeType.Succeed;

            outcomeType = (OutcomeType)RandomUtil.GetWeightedIndex(GetOutcomeWeights());
            PlayFaceoffAnims(false);
            switch (outcomeType)
            {
            case OutcomeType.Succeed:
                if (Target.LotCurrent != Target.LotHome)
                {
                    if (Target.IsHuman)
                    {
                        Target.RequestWalkStyle(WalkStyle.MeanChasedRun);
                    }
                    else
                    {
                        Target.RequestWalkStyle(WalkStyle.PetRun);
                    }
                    // Success! Actor drove the unwanted sim off the lot.
                    skillActor.AddPoints(200f, true, true);                               // Successful driving off a foe gains skill
                    MakeSimGoHome(Target, false);
                }

                break;

            case OutcomeType.Fight:
                if (!Actor.HasExitReason(ExitReason.Default) && !Target.HasExitReason(ExitReason.Default))
                {
                    if (Target.IsHuman)
                    {
                        EWPetAttackSim continuation = EWPetAttackSim.Singleton.CreateInstance(Target, Actor,
                                                                                              new InteractionPriority(InteractionPriorityLevel.High), Autonomous,
                                                                                              cancellableByPlayer: true) as EWPetAttackSim;
                        continuation.SetParams(true, false);
                        Actor.InteractionQueue.TryPushAsContinuation(this, continuation);
                    }
                    else
                    {
                        EWFightPet continuation = EWFightPet.Singleton.CreateInstance(Target, Actor,
                                                                                      new InteractionPriority(InteractionPriorityLevel.High), Autonomous,
                                                                                      cancellableByPlayer: true) as EWFightPet;
                        continuation.SetParams(true, false);
                        Actor.InteractionQueue.TryPushAsContinuation(this, continuation);
                    }
                }
                break;

            case OutcomeType.Reversal:
                // In this situation, a pet target will mean chase the actor and a human target will scold

                PlayFaceoffAnims(true);
                if (!Actor.HasExitReason(ExitReason.Default) && !Target.HasExitReason(ExitReason.Default))
                {
                    if (Target.IsHuman)
                    {
                        // Scold naughty actor
                        PlayScoldAnims();
                    }
                    else
                    {
                        EWChaseMean chaseMean = InteractionUtil.CreateInstance(this, Singleton, Actor, Target) as EWChaseMean;
                        if (chaseMean != null)
                        {
                            chaseMean.PreviouslyAccepted = true;
                            chaseMean.NumLoops           = Math.Max(0, NumLoops - 1);
                            Target.InteractionQueue.TryPushAsContinuation(this, chaseMean);
                        }
                    }
                }
                break;

            case OutcomeType.ChaseAgain:
                if (!Actor.HasExitReason(ExitReason.Default) && !Target.HasExitReason(ExitReason.Default) && base.NumLoops > 0)
                {
                    EWChaseOffLot chaseMean = InteractionUtil.CreateInstance(this, Singleton, Target, Actor) as EWChaseOffLot;
                    if (chaseMean != null)
                    {
                        chaseMean.PreviouslyAccepted = true;
                        chaseMean.NumLoops           = Math.Max(0, NumLoops - 1);
                        Actor.InteractionQueue.TryPushAsContinuation(this, chaseMean);
                    }
                }
                break;
            }
            EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Actor, Target, "Chase Mean", wasRecipient: false, wasAccepted: true, actorWonFight: false, CommodityTypes.Undefined));
            EventTracker.SendEvent(new SocialEvent(EventTypeId.kSocialInteraction, Target, Actor, "Chase Mean", wasRecipient: true, wasAccepted: true, actorWonFight: false, CommodityTypes.Undefined));
            skillActor.StopSkillGain();
        }