Пример #1
0
 public static void AddInteractions(GameObject obj)
 {
     obj.RemoveAllInteractions();
     if ((obj != null) && (obj.Interactions != null))
     {
         obj.AddInteraction(ShoppingInteraction.ShopForClothes.Singleton);
         obj.AddInteraction(ShoppingInteraction.SuggestOutfit.Singleton);
     }
 }
Пример #2
0
 public static void AddInteractions(GameObject obj)
 {
     obj.RemoveAllInteractions();
     if ((obj != null) && (obj.Interactions != null))
     {
         obj.AddInteraction(ShoppingInteraction.ShopForClothes.Singleton);
         obj.AddInteraction(ShoppingInteraction.SuggestOutfit.Singleton);
     }
 }
Пример #3
0
        public static void AddInteractionsForCoffeeMaker(GameObject obj)
        {
            InteractionObjectPair i = new InteractionObjectPair(CoffeeInteractions.OverridedServeCoffee.Singleton, obj);

            if (!obj.Interactions.Contains(i))
            {
                obj.AddInteraction(CoffeeInteractions.OverridedServeCoffee.Singleton);
                obj.AddInteraction(CoffeeInteractions.OverridedMakeHotBeverage.MenuSingleton);
                obj.AddInteraction(CoffeeInteractions.OverridedMakeHotBeverage.NormalSingleton);
            }
        }
Пример #4
0
        public static void AddInteractionForTray(GameObject obj)
        {
            List <InteractionObjectPair> list = CommonMethods.ReturnInteractionIndex(obj.Interactions, "CallForCoffee");

            if (list == null || (list != null && list.Count == 0))
            {
                obj.AddInteraction(CoffeeInteractions.CallForCoffee.Singleton);
            }
        }
Пример #5
0
        public static ListenerAction OnObjectChanged(Event e)
        {
            Sim   a = e.Actor as Sim;
            Plant p = e.TargetObject as Plant;

            if (p != null)
            {
                //p.AddInteraction(EWPetMarkPlant.Singleton, true);
                p.AddInteraction(EWPetWatchPlant.Singleton, true);
                p.AddInteraction(EWPetHarvest.Singleton, true);
                p.AddInteraction(EWPetWeedPlant.Singleton, true);
                p.AddInteraction(EWPetWaterPlant.Singleton, true);
                p.AddInteraction(EWPetDisposePlant.Singleton, true);
            }

            // Turning this off until I can test it
            if (a.IsPet && e.TargetObject.InInventory && !(e.TargetObject.Plantable == null) && false)
            {
                bool has_plant = false;
                foreach (InteractionObjectPair pair in e.TargetObject.GetAllInventoryInteractionsForActor(a))
                {
                    if (pair.InteractionDefinition.GetType() == EWPetPlantSeed.Singleton.GetType())
                    {
                        has_plant = true;
                        break;
                    }
                }
                if (!has_plant)
                {
                    GameObject o = e.TargetObject as GameObject;
                    o.AddInventoryInteraction(EWPetPlantSeed.Singleton);
                    o.AddInventoryInteraction(EWPetTreatNausea.Singleton);
                    o.AddInteraction(EWPetPickUpPlantable.Singleton, true);
                }
            }
            else if (e.TargetObject.CatHuntingComponent != null)
            {
                if (e.TargetObject.CatHuntingComponent.mPreyData.PreyType == CatHuntingSkill.PreyType.Rodent)
                {
                    bool has_treatFleas = false;
                    foreach (InteractionObjectPair pair in e.TargetObject.GetAllInventoryInteractionsForActor(e.Actor))
                    {
                        if (pair.InteractionDefinition.GetType() == EWPetTreatFleas.Singleton.GetType())
                        {
                            has_treatFleas = true;
                            break;
                        }
                    }
                    if (!has_treatFleas)
                    {
                        GameObject o = e.TargetObject as GameObject;
                        o.AddInventoryInteraction(EWPetTreatFleas.Singleton);
                    }
                }
            }
            return(ListenerAction.Keep);
        }
Пример #6
0
        public void AddInteractionsToChildren()
        {
            this.RemoveInteractionsFromChildren();
            List <ObjectGuid> objectsICanBuyInDisplay = this.GetObjectIDsICanBuyInDisplay(null, false);

            for (int i = 0; i < objectsICanBuyInDisplay.Count; i++)
            {
                GameObject gameObject = GlobalFunctions.ConvertGuidToObject <GameObject>(objectsICanBuyInDisplay[i]);
                if (gameObject != null)
                {
                    if (StoreHelperClass.AddPurchaseInteraction(null, gameObject, null, true))
                    {
                        gameObject.RemoveAllInteractions();
                        this.mObjectsWithMyInteraction.Add(objectsICanBuyInDisplay[i]);
                        gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectPurchaseStub.Singleton);
                        gameObject.RemoveInteractionByType(StoreSetBase.ChildObjectBrowseStub.Singleton);
                        gameObject.AddInteraction(new StoreSetBase.ChildObjectPurchaseStub.Definition(base.ObjectId));
                        gameObject.AddInteraction(new StoreSetBase.ChildObjectBrowseStub.Definition(base.ObjectId));
                    }
                }
            }
        }
Пример #7
0
        public static void InitInteractions(GameObject obj)
        {
            ServingContainer container = obj as ServingContainer;

            if (container != null)
            {
                // EA fail
                container.RemoveInteractionByType(ServingContainerGroup.CallToMeal.Singleton);
            }

            WeddingCake cake = obj as WeddingCake;

            if (cake != null)
            {
                cake.RemoveInteractionByType(WeddingCake.CutWeddingCake.Singleton);
            }

            Snack container2 = obj as Snack;

            if (container2 != null)
            {
                if (obj != null)
                {
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectPurchaseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectPurchaseStub.Singleton);

                    obj.RemoveInteractionByType(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton);
                    obj.RemoveInteractionByType(Snack_CleanUp.Singleton);
                }

                ISpoilable spoil = container2 as ISpoilable;
                if (spoil != null)
                {
                    spoil.UpdateSpoilageTime(true, -1f);
                }
            }
        }
Пример #8
0
        public static void AddInteractions(GameObject obj)
        {
            Grill         grill     = obj as Grill;
            Stove         stove     = obj as Stove;
            Fridge        fridge    = obj as Fridge;
            Microwave     micro     = obj as Microwave;
            FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
                if (fridge != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.RemoveInteractionByType(Fridge_Have.Singleton);
                        // obj.Interactions.RemoveAt(0);
                        obj.AddInteraction(OverridedFridge_Have.Singleton);
                        obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton);
                    }
                }
                else if (micro != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedMicrowave_Have.Singleton);
                    }
                }
                else if (processor != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedFoodProcessor_Have.Singleton);
                    }
                }
                else if (stove != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedStove_Have.Singleton);
                    }
                }
                else if (grill != null)
                {
                    InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    if (!obj.Interactions.Contains(i2))
                    {
                        obj.AddInteraction(OverridedGrill_Have.Singleton);
                    }
                }
            }
        }
Пример #9
0
        public static void AddInteractions(GameObject obj)
        {
            foreach (InteractionObjectPair pair in obj.Interactions)
            {
                if (pair.InteractionDefinition.GetType() == Version.Singleton.GetType())
                {
                    return;
                }
            }

            List <InteractionDefinition> interactions = new List <InteractionDefinition>();

            interactions.Add(SpawnOpportunity.Singleton);
            interactions.Add(RandomOpportunity.Singleton);
            interactions.Add(ResetAllOpportunities.Singleton);
            interactions.Add(Version.Singleton);

            foreach (InteractionDefinition interaction in interactions)
            {
                obj.AddInteraction(interaction);
                obj.AddInventoryInteraction(interaction);
            }
        }
Пример #10
0
        public void AddMoveInteractions(GameObject gameObject)
        {
            movingThings.Add(gameObject);
            //debugger.Debug(this, "adding interaction to " + gameObject.CatalogName);
            List <InteractionDefinition> actions = new List <InteractionDefinition>();

            actions.Add(MoveUp.Singleton);
            actions.Add(MoveUpUserDefined.Singleton);
            actions.Add(MoveDown.Singleton);
            actions.Add(MoveDownUserDefined.Singleton);
            actions.Add(TurnLeft.Singleton);
            actions.Add(TurnRight.Singleton);
            actions.Add(TurnAround.Singleton);
            actions.Add(TiltFaceUp.Singleton);
            actions.Add(TiltBack.Singleton);
            actions.Add(TiltForward.Singleton);
            actions.Add(TiltFaceDown.Singleton);
            actions.Add(TiltUserDefined.Singleton);
            actions.Add(MoveBack.Singleton);
            actions.Add(MoveBackUserDefined.Singleton);
            actions.Add(MoveForward.Singleton);
            actions.Add(MoveForwardUserDefined.Singleton);
            actions.Add(MoveRight.Singleton);
            actions.Add(MoveRightUserDefined.Singleton);
            actions.Add(MoveLeft.Singleton);
            actions.Add(MoveLeftUserDefined.Singleton);


            foreach (InteractionDefinition def in actions)
            {
                gameObject.AddInteraction(def);
            }
            //debugger.Debug(this, "Added regular action ");
            gameObject.AddBuildBuyInteractions(actions);

            //debugger.Debug(this, "Added build action ");
        }
Пример #11
0
 public static void ReplaceInteraction <DEF>(GameObject obj, InteractionDefinition newDef, bool checkForDup) where DEF : InteractionDefinition
 {
     obj.RemoveInteractionByType(typeof(DEF));
     obj.AddInteraction(newDef, checkForDup);
 }
Пример #12
0
        public override bool Run()
        {
            Definition interactionDefinition = base.InteractionDefinition as Definition;

            if (interactionDefinition == null)
            {
                return(false);
            }
            ObjectGuid mObject = interactionDefinition.mObject;
            int        mCost   = interactionDefinition.mCost;

            if (mObject == ObjectGuid.InvalidObjectGuid)
            {
                List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target);
                if (!Autonomous && Actor.IsSelectable)
                {
                    List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>();
                    foreach (ObjectGuid current in objectsICanBuyInDisplay)
                    {
                        GameObject           obj  = GlobalFunctions.ConvertGuidToObject <GameObject>(current);
                        ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(current, new List <ObjectPicker.ColumnInfo>
                        {
                            new ObjectPicker.ThumbAndTextColumn(obj.GetThumbnailKey(), obj.GetLocalizedName()),
                            new ObjectPicker.MoneyColumn(DisplayHelper.ComputeFinalPriceOnObject(obj, true))
                        });
                        list.Add(item);
                    }
                    List <ObjectPicker.HeaderInfo> list2 = new List <ObjectPicker.HeaderInfo>();
                    List <ObjectPicker.TabInfo>    list3 = new List <ObjectPicker.TabInfo>();
                    list2.Add(new ObjectPicker.HeaderInfo(ShoppingRegister.sLocalizationKey + ":BuyFoodColumnName", ShoppingRegister.sLocalizationKey + ":BuyFoodColumnTooltip", 200));
                    list2.Add(new ObjectPicker.HeaderInfo("Ui/Caption/Shopping/Cart:Price", "Ui/Tooltip/Shopping/Cart:Price"));
                    list3.Add(new ObjectPicker.TabInfo("", ShoppingRegister.LocalizeString("AvailableFoods"), list));
                    List <ObjectPicker.RowInfo> list4 = SimplePurchaseDialog.Show(ShoppingRegister.LocalizeString("BuyFoodTitle"), Actor.FamilyFunds, list3, list2, true);
                    if (list4 == null || list4.Count != 1)
                    {
                        return(false);
                    }
                    mObject = (ObjectGuid)list4[0].Item;
                    mCost   = ((ObjectPicker.MoneyColumn)list4[0].ColumnInfo[1]).Value;
                }
                else
                {
                    RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay);
                    int familyFunds = base.Actor.FamilyFunds;
                    for (int i = 0; i < objectsICanBuyInDisplay.Count; i++)
                    {
                        int cost = DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]);
                        if (cost <= familyFunds)
                        {
                            //Definition continuationDefinition = new Definition(objectsICanBuyInDisplay[i], cost, false);
                            //base.TryPushAsContinuation(continuationDefinition);
                            //return true;
                            mObject = objectsICanBuyInDisplay[i];
                            mCost   = cost;
                            break;
                        }
                    }
                    //return false;
                }
            }
            if (mObject == ObjectGuid.InvalidObjectGuid)
            {
                return(false);
            }
            if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping()))
            {
                return(false);
            }
            base.Actor.RouteTurnToFace(base.Target.Position);
            if (!DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target).Contains(mObject))
            {
                return(false);
            }
            if (base.Actor.FamilyFunds < mCost)
            {
                return(false);
            }
            GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(mObject);

            if (target == null)
            {
                return(false);
            }

            base.StandardEntry();
            base.BeginCommodityUpdates();
            string swipeAnimationName = base.Target.GetSwipeAnimationName(target);

            if (Actor.SimDescription.Child)
            {
                swipeAnimationName = "c" + swipeAnimationName.Substring(1);
            }
            base.Actor.PlaySoloAnimation(swipeAnimationName, true);
            VisualEffect effect = VisualEffect.Create(base.Target.GetSwipeVfxName());
            Vector3      zero   = Vector3.Zero;
            Vector3      axis   = Vector3.Zero;

            if (Slots.AttachToBone(effect.ObjectId, base.Target.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref axis, 0f) == TransformParentingReturnCode.Success)
            {
                effect.SetAutoDestroy(true);
                effect.Start();
            }
            else
            {
                effect.Dispose();
                effect = null;
            }
            //bool flag = false;
            //bool flag2 = false;
            bool   succeeded       = false;
            bool   addInteractions = true;
            string tnsKey          = null;

            if (target.IsLiveDraggingEnabled() && !target.InUse && (interactionDefinition.mPushEat || (target.ItemComp != null && target.ItemComp.CanAddToInventory(base.Actor.Inventory) && base.Actor.Inventory.CanAdd(target)))) //&& base.Actor.Inventory.TryToAdd(target)))
            {
                ServingContainerGroup groupServing = null;
                if (interactionDefinition.mSingleServing)
                {
                    groupServing = target as ServingContainerGroup;
                    if (groupServing != null)
                    {
                        target          = groupServing.CookingProcess.CreateSingleServingOfFood(groupServing, true, true);
                        addInteractions = false;
                    }
                }
                if (interactionDefinition.mPushEat)
                {
                    target.SetOpacity(0f, 0f);
                    if (Actor.ParentToRightHand(target))
                    {
                        succeeded = true;
                        CarrySystem.EnterWhileHolding(Actor, target as ICarryable);
                    }
                    target.FadeIn();
                }
                else if (Actor.Inventory.TryToAdd(target))
                {
                    succeeded = true;
                    tnsKey    = "PlacedInPersonalInventory";
                }
                if (succeeded)
                {
                    if (groupServing != null)
                    {
                        groupServing.DecrementServings();
                        if (groupServing.NumServingsLeft == 0)
                        {
                            groupServing.FadeOut(false, true);
                        }
                    }
                }
                else if (groupServing != null && target != null)
                {
                    target.Destroy();
                }
            }
            else if (!target.InUse && base.Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(target))
            {
                succeeded = true;
                tnsKey    = "PlacedInFamilyInventory";
            }
            //bool succeeded = flag || flag2;
            if (succeeded)
            {
                if (addInteractions)
                {
                    Target.OnHandToolChildUnslotted(target, Slot.None);
                    if (target is Snack)
                    {
                        target.AddInteraction(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton, true);
                        target.AddInteraction(Snack_CleanUp.Singleton, true);
                    }
                }

                /*if (flag2)
                 * {
                 *  base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInFamilyInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive);
                 * }
                 * else
                 * {
                 *  base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInPersonalInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive);
                 * }*/
                if (tnsKey != null)
                {
                    Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(Actor.IsFemale, tnsKey, new object[] { Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive);
                }
                base.Target.GiveMarkupBuffs(base.Actor, mObject);
                base.Actor.ModifyFunds(-mCost);
                base.Target.GiveLotOwnerMoney(mCost, base.Actor);
                base.Target.AccumulateRevenue(mCost);
                if (interactionDefinition.mPushEat)
                {
                    (target as IFoodContainer).PushEatHeldFoodInteraction(Actor);
                }
            }
            base.EndCommodityUpdates(succeeded);
            base.StandardExit();
            return(succeeded);
        }
Пример #13
0
        public static void InitInteractions(GameObject obj)
        {
            ServingContainer container = obj as ServingContainer;
            if (container != null)
            {
                // EA fail
                container.RemoveInteractionByType(ServingContainerGroup.CallToMeal.Singleton);
            }

            WeddingCake cake = obj as WeddingCake;
            if (cake != null)
            {
                cake.RemoveInteractionByType(WeddingCake.CutWeddingCake.Singleton);
            }

            Snack container2 = obj as Snack;
            if (container2 != null)
            {
                if (obj != null)
                {
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.RemoveInteractionByType(CraftersConsignment.ChildObjectPurchaseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectBrowseStub.Singleton);
                    obj.AddInteraction(CraftersConsignment.ChildObjectPurchaseStub.Singleton);

                    obj.RemoveInteractionByType(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton);
                    obj.RemoveInteractionByType(Snack_CleanUp.Singleton);
                }

                ISpoilable spoil = container2 as ISpoilable;
                if (spoil != null)
                {
                    spoil.UpdateSpoilageTime(true, -1f);
                }
            }
        }
Пример #14
0
        public static void AddInteractions(GameObject obj)
        {
            //Grill grill = obj as Grill;
            //Stove stove = obj as Stove;
            //Fridge fridge = obj as Fridge;
            //Microwave micro = obj as Microwave;
            //FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
                if (obj is Fridge)                 //(fridge != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    // {
                    obj.RemoveInteractionByType(typeof(Fridge_Have.Definition));
                    obj.RemoveInteractionByType(typeof(Fridge_Prepare.PrepareDefinition));
                    // obj.Interactions.RemoveAt(0);
                    obj.AddInteraction(OverridedFridge_Have.Singleton, true);
                    obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton, true);

                    //}
                }
                else if (obj is Microwave)                //(micro != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Microwave_Have.Definition));
                    obj.AddInteraction(OverridedMicrowave_Have.Singleton, true);

                    //}
                }
                else if (obj is FoodProcessor)                //(processor != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(FoodProcessor.FoodProcessor_Have.Definition));
                    obj.AddInteraction(OverridedFoodProcessor_Have.Singleton, true);
                    //}
                }
                else if (obj is Stove)                //(stove != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Stove_Have.Definition));
                    obj.AddInteraction(OverridedStove_Have.Singleton, true);
                    //}
                }
                else if (obj is Grill)                //(grill != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
                    obj.RemoveInteractionByType(typeof(Grill_Have.Definition));
                    obj.AddInteraction(OverridedGrill_Have.Singleton, true);
                    //}
                }
            }
        }
        public static void AddMoveInteractions(GameObject gameObject)
        {
            if (!(gameObject is Sim))
            {
                LocationVectors vectors = new LocationVectors();
                vectors.ForwardVector = new Vector3(gameObject.ForwardVector);
                vectors.Position      = new Vector3(gameObject.Position);
                MovedObjects.Add(gameObject, vectors);
                gameObject.AddInteraction(StopMovingMe.Singleton);
            }

            gameObject.AddInteraction(MoveUp.Singleton);
            gameObject.AddInteraction(MoveUpUserDefined.Singleton);
            gameObject.AddInteraction(MoveDown.Singleton);
            gameObject.AddInteraction(MoveDownUserDefined.Singleton);
            gameObject.AddInteraction(TurnLeft.Singleton);
            gameObject.AddInteraction(TurnRight.Singleton);
            gameObject.AddInteraction(TurnAround.Singleton);
            gameObject.AddInteraction(TiltFaceUp.Singleton);
            gameObject.AddInteraction(TiltBack.Singleton);
            gameObject.AddInteraction(TiltForward.Singleton);
            gameObject.AddInteraction(TiltFaceDown.Singleton);
            gameObject.AddInteraction(TiltUserDefined.Singleton);
            gameObject.AddInteraction(MoveBack.Singleton);
            gameObject.AddInteraction(MoveBackUserDefined.Singleton);
            gameObject.AddInteraction(MoveForward.Singleton);
            gameObject.AddInteraction(MoveForwardUserDefined.Singleton);
            gameObject.AddInteraction(MoveRight.Singleton);
            gameObject.AddInteraction(MoveRightUserDefined.Singleton);
            gameObject.AddInteraction(MoveLeft.Singleton);
            gameObject.AddInteraction(MoveLeftUserDefined.Singleton);
            gameObject.AddInteraction(TurnAtAngle.Singleton);
        }
Пример #16
0
        public static void AddInteractions(GameObject obj)
        {
            if (obj != null && obj.Interactions != null)
            {
                //Show the interactions only when at home
                WorldType type = GameUtils.GetCurrentWorldType();
                if (type != WorldType.Vacation)
                {
                    // InteractionObjectPair i = new InteractionObjectPair(RegisterInteraction.ShopFromInventory.Singleton, obj);
                    InteractionObjectPair i = new InteractionObjectPair(ShoppingRegister.Buy.Singleton, obj);
                    if (obj.Interactions.Contains(i))
                    {
                        //StyledNotification.Show(new StyledNotification.Format(obj.GetType().ToString(), StyledNotification.NotificationStyle.kGameMessageNegative));
                        //Replace the original buyfood interaction
                        if (obj.GetType() == typeof(FoodStoreRegister))
                        {
                            obj.RemoveInteractionByType(ShoppingRegister.Buy.Singleton);
                            obj.RemoveInteractionByType(ShoppingRegister.Buy_Food.Singleton);

                            obj.AddInteraction(OverridedFoodRegister.Buy.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.CallForMeal.Singleton);
                            obj.AddInteraction(OverridedFoodRegisterServing.Buy.Singleton);

                            obj.AddInteraction(OverridedFoodRegister.CallForCoffee.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.BuyConcessionDrink.Singleton);
                            obj.AddInteraction(OverridedFoodRegister.BuyCupOffCoffee.Singleton);

                            if (ShowBuyGroceries)
                            {
                                obj.AddInteraction(OverridedRegister.Buy.Singleton);
                            }
                        }
                        else if (obj.GetType() == typeof(ConcessionsStand))
                        {
                            //obj.RemoveInteractionByType(ConcessionsStand.Buy_FoodFromConcessionsStand.Singleton);
                            //obj.AddInteraction(OverridedBuyFoodFromConcessionsStand.SingletonConcessionsStand);
                        }
                        else
                        {
                            //Replace the original buy interaction
                            obj.RemoveInteractionByType(ShoppingRegister.Buy.Singleton);
                            obj.AddInteraction(OverridedRegister.Buy.Singleton);
                        }

                        if (ShowBuyFromInventory)
                        {
                            obj.AddInteraction(RegisterInteraction.ShopFromInventory.Singleton);
                        }
                    }
                }
                else
                {
                    //Call to meal should also be seen abroad.
                    if (obj.GetType() == typeof(FoodStoreRegister))
                    {
                        InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodRegister.CallForMeal.Singleton, obj);
                        if (!obj.Interactions.Contains(i2))
                        {
                            obj.AddInteraction(OverridedFoodRegister.CallForMeal.Singleton);
                        }
                    }
                }
            }
        }
        public static void AddMoveInteractions(GameObject gameObject)
        {
            if (!(gameObject is Sim))
            {
                LocationVectors vectors = new LocationVectors();
                vectors.ForwardVector = new Vector3(gameObject.ForwardVector);
                vectors.Position = new Vector3(gameObject.Position);
                MovedObjects.Add(gameObject, vectors);
                gameObject.AddInteraction(StopMovingMe.Singleton);
            }

            gameObject.AddInteraction(MoveUp.Singleton);
            gameObject.AddInteraction(MoveUpUserDefined.Singleton);
            gameObject.AddInteraction(MoveDown.Singleton);
            gameObject.AddInteraction(MoveDownUserDefined.Singleton);
            gameObject.AddInteraction(TurnLeft.Singleton);
            gameObject.AddInteraction(TurnRight.Singleton);
            gameObject.AddInteraction(TurnAround.Singleton);
            gameObject.AddInteraction(TiltFaceUp.Singleton);
            gameObject.AddInteraction(TiltBack.Singleton);
            gameObject.AddInteraction(TiltForward.Singleton);
            gameObject.AddInteraction(TiltFaceDown.Singleton);
            gameObject.AddInteraction(TiltUserDefined.Singleton);
            gameObject.AddInteraction(MoveBack.Singleton);
            gameObject.AddInteraction(MoveBackUserDefined.Singleton);
            gameObject.AddInteraction(MoveForward.Singleton);
            gameObject.AddInteraction(MoveForwardUserDefined.Singleton);
            gameObject.AddInteraction(MoveRight.Singleton);
            gameObject.AddInteraction(MoveRightUserDefined.Singleton);
            gameObject.AddInteraction(MoveLeft.Singleton);
            gameObject.AddInteraction(MoveLeftUserDefined.Singleton);
            gameObject.AddInteraction(TurnAtAngle.Singleton);
        }
Пример #18
0
        public static void AddInteractions(GameObject obj)
        {
            //Grill grill = obj as Grill;
            //Stove stove = obj as Stove;
            //Fridge fridge = obj as Fridge;
            //Microwave micro = obj as Microwave;            
            //FoodProcessor processor = obj as FoodProcessor;

            if (obj != null && obj.Interactions != null)
            {
				if (obj is Fridge) //(fridge != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFridge_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                   // {
						obj.RemoveInteractionByType(typeof(Fridge_Have.Definition));
						obj.RemoveInteractionByType (typeof(Fridge_Prepare.PrepareDefinition));
                       // obj.Interactions.RemoveAt(0);
                        obj.AddInteraction(OverridedFridge_Have.Singleton, true);
                        obj.AddInteraction(OverridedFridge_Prepare.PrepareSingleton, true);
                        
                    //}
                }
				else if (obj is Microwave)//(micro != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedMicrowave_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Microwave_Have.Definition));
                        obj.AddInteraction(OverridedMicrowave_Have.Singleton, true);

                    //}
                }
				else if (obj is FoodProcessor)//(processor != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedFoodProcessor_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(FoodProcessor.FoodProcessor_Have.Definition));
                        obj.AddInteraction(OverridedFoodProcessor_Have.Singleton, true);
                    //}
                }
				else if (obj is Stove)//(stove != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedStove_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Stove_Have.Definition));
                        obj.AddInteraction(OverridedStove_Have.Singleton, true);
                    //}
                }
				else if (obj is Grill)//(grill != null)
                {
                    //InteractionObjectPair i2 = new InteractionObjectPair(OverridedGrill_Have.Singleton, obj);
                    //if (!obj.Interactions.Contains(i2))
                    //{
						obj.RemoveInteractionByType (typeof(Grill_Have.Definition));
                        obj.AddInteraction(OverridedGrill_Have.Singleton, true);
                    //}
                }

            }
        }