Пример #1
0
            protected override void PrivatePerform(StateMachineClient smc, InteractionInstance.LoopData loopData)
            {
                if (SimClock.ElapsedTime(TimeUnit.Minutes, mInteraction.mLastLTRUpdateDateAndTime) >= GoToSchoolInRabbitHole.kSimMinutesBetweenLTRUpdates)
                {
                    if (RandomUtil.RandomChance(kBugClubCollectChance))
                    {
                        List <InsectJig> insects = new List <InsectJig>(Sims3.Gameplay.Queries.GetObjects <InsectJig>());

                        if (insects.Count > 0)
                        {
                            InsectJig insect = RandomUtil.GetRandomObjectFromList(insects);

                            Terrarium terrarium = InsectTerrarium.Create(insect, mInteraction.Actor);

                            if (terrarium != null)
                            {
                                string msg = Common.Localize("AfterschoolFoundObject:Notice", mInteraction.Actor.IsFemale, new object[] { mInteraction.Actor, terrarium.GetLocalizedName() });

                                mInteraction.Actor.ShowTNSIfSelectable(msg, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, terrarium.ObjectId);
                            }
                        }
                    }
                }

                mInteraction.AfterschoolActivityLoopDelegate(smc, loopData);
            }
Пример #2
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _gameContent  = new GameContent(Content);
            _screenWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            _screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            // set game to 1000 x 500 or screen max if smaller
            if (_screenWidth >= 2000)
            {
                _screenWidth = 2000;
            }
            if (_screenHeight >= 500)
            {
                _screenHeight = 500;
            }
            _graphics.PreferredBackBufferWidth  = _screenWidth;
            _graphics.PreferredBackBufferHeight = _screenHeight;
            _graphics.ApplyChanges();

            // create game objects
            _mainCharacter = new PlayerPuthid(100, 100, _spriteBatch, _gameContent);

            // Build out terrarium
            _terr1  = new Terrarium(10, 10, 800, 450, 25, _spriteBatch); // refactor to: new Terrarium(float x, float y, wallThickness, airHeight, groundGrid, _spriteBatch);
            _terr2  = new Terrarium(1200, 10, 300, 450, 10, _spriteBatch);
            _colony = new List <NPCPuthid>
            {
                new NPCPuthid(500, 130, _spriteBatch, _gameContent)
            };

            _house = new House(40, 75, _spriteBatch, _gameContent);
        }
Пример #3
0
        public void NieuwePlantHeeftLevenskrachtEen()
        {
            Terrarium testTerrarium = new Terrarium(3, 3);
            Plant     plant         = new Plant();

            plant.Position  = new Position(1, 1);
            plant.Terrarium = testTerrarium;
            Assert.AreEqual(1, plant.Health);
        }
Пример #4
0
 public void Initialize()
 {
     Terrarium = new Terrarium(6, 6);
     begin     = new Position(1, 1);
     end       = new Position(2, 1);
     Terrarium = new Terrarium(3, 3);
     mens      = new Human(begin, Terrarium);
     toDelete  = new List <IOrganism>();
 }
Пример #5
0
 public void Initialize()
 {
     testTerrarium = new Terrarium(5, 5);
     plant         = new Plant();
     herbivore     = new Herbivore();
     carnivore     = new Carnivore();
     human         = new Human();
     vulcano       = new Vulcano();
     time          = new TimeController(0, testTerrarium);
 }
Пример #6
0
 public void Initialize()
 {
     testTerrarium = new Terrarium(10, 10);
     plant         = new Plant();
     herbivore     = new Herbivore();
     carnivore     = new Carnivore();
     human         = new Human();
     earthquake    = new EarthQuake();
     time          = new TimeController(0, testTerrarium);
 }
Пример #7
0
 public AntHill(Terrarium Area)
 {
     Position     = new Point();
     this.Area    = Area;
     Speed        = 1;
     Shape        = new Ellipse();
     Shape.Width  = Area.Rand.Next(50, 140);
     Shape.Height = Area.Rand.Next(50, 140);
     Shape.Fill   = Brushes.Pink;
     Position.X   = Area.Spawn.X - Shape.Width / 2;
     Position.Y   = Area.Spawn.Y - Shape.Height / 2;
 }
Пример #8
0
 public Food(double x, double y, Terrarium Area)
 {
     this.Area    = Area;
     Position     = new Point();
     Shape        = new Ellipse();
     Shape.Width  = 7;
     Shape.Height = 7;
     Shape.Fill   = Brushes.Green;
     FoodCount    = Area.Rand.Next(1, 10);
     Position.X   = x;
     Position.Y   = y;
     Speed        = 3;
 }
Пример #9
0
        internal void Act(Terrarium terr)
        {
            switch (FacingDirection)
            {
            case Direction.LEFT:
                this.MoveLeft(terr);
                break;

            case Direction.RIGHT:
                this.MoveRight(terr);
                break;

            case Direction.FORWARD:
                this.FaceForward(terr);
                break;
            }
        }
Пример #10
0
 public Food(Terrarium Area)
 {
     Position     = new Point();
     this.Area    = Area;
     Shape        = new Ellipse();
     Shape.Width  = 7;
     Shape.Height = 7;
     Shape.Fill   = Brushes.Green;
     FoodCount    = Area.Rand.Next(1, 10);
     Position.X   = Area.Rand.Next(1, Area.XLength - 10);
     Position.Y   = Area.Rand.Next(1, Area.YLenght - 10);
     Speed        = 3;
     for (int i = 0; i < FoodCount; i++)
     {
         Area.TerrariumList.Add(new Food(Position.X + Area.Rand.Next(-3, 4), Position.Y + Area.Rand.Next(-3, 4), Area));
     }
 }
Пример #11
0
 public Queen(Terrarium Area, AntHill Home)
 {
     this.Home    = Home;
     Position     = new Point();
     Aim          = new Point();
     this.Area    = Area;
     Speed        = 0.5;
     Position.X   = Area.Spawn.X;
     Position.Y   = Area.Spawn.Y;
     Shape        = new Ellipse();
     Shape.Width  = 10;
     Shape.Height = 10;
     Shape.Fill   = Brushes.Red;
     Aim.X        = Position.X + Area.Rand.Next(-10, 11);
     Aim.Y        = Position.Y + Area.Rand.Next(-10, 11);
     Step         = 10;
     Target       = false;
     VisibleRange = 40;
     StepRange    = new Point(Area.Spawn.X - Shape.Width / 2, Area.Spawn.Y - Shape.Width / 2);
 }
Пример #12
0
        public static Terrarium Create(InsectJig ths, Sim actor)
        {
            Terrarium terrarium = Terrarium.Create(ths.InsectType);

            if (Inventories.TryToMove(terrarium, actor))
            {
                InsectData data;
                if (InsectData.sData.TryGetValue(ths.InsectType, out data))
                {
                    bool flag;
                    bool flag2;
                    (actor.SkillManager.AddElement(SkillNames.Collecting) as Collecting).Collected(ths.InsectType, actor, terrarium, out flag, out flag2);

                    /*
                     * string str = CatchInsect.GetLocalizedCatchSuccessTNS(this.InsectType, data.Rarity, terrarium.Value, actor);
                     * string message = str;
                     * if (flag)
                     * {
                     *  string str3 = CatchInsect.LocalizeString(actor.IsFemale, "TNSScienceLab", new object[0]);
                     *  message = CatchInsect.LocalizeString(actor.IsFemale, "TNSFullPlusScienceLab", new object[] { str, str3 });
                     * }
                     * actor.ShowTNSIfSelectable(message, StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid);
                     * if (!flag2)
                     * {
                     *  actor.Play3dStingIfSelectable("sting_collect_collection");
                     * }
                     */

                    EventTracker.SendEvent(EventTypeId.kCaughtBug, actor, terrarium);
                    ActiveTopic.AddToSim(actor, "Recently Collected Bugs");
                }

                return(terrarium);
            }
            else
            {
                terrarium.Destroy();
                return(null);
            }
        }
Пример #13
0
 public void Initialize()
 {
     terrarium = new Terrarium(1, 1);
 }
Пример #14
0
 public void Initialize()
 {
     testTerrarium = new Terrarium(6, 6);
 }
Пример #15
0
        public static GameObject ReturnShoppingObject(RestockItem rItem, SimDescription actor, StoreSetRegister register)
        {
            GameObject o           = null;
            bool       keepLooping = true;

            switch (rItem.info.Type)
            {
            case ItemType.Herb:
            case ItemType.Ingredient:
                foreach (KeyValuePair <string, List <StoreItem> > kvp in Grocery.mItemDictionary)
                {
                    foreach (StoreItem item in kvp.Value)
                    {
                        if (item.Name.Equals(rItem.info.Name))
                        {
                            keepLooping = false;
                            IngredientData data = (IngredientData)item.CustomData;
                            if (rItem.info.Type == ItemType.Ingredient)
                            {
                                o = Ingredient.Create(data);
                            }
                            else
                            {
                                o = Herb.Create(data);
                                //PlantableNonIngredientData data = (PlantableNonIngredientData)item.CustomData;
                                //o = (GameObject)PlantableNonIngredient.Create(data);
                            }
                            break;
                        }
                    }
                    if (!keepLooping)
                    {
                        break;
                    }
                }

                break;

            case ItemType.Fish:
                o = Fish.CreateFishOfRandomWeight(rItem.info.FType);
                break;

            case ItemType.Craftable:
                break;

            case ItemType.Gem:
            case ItemType.Metal:

                o = (GameObject)RockGemMetalBase.Make(rItem.info.RockData, false);
                break;

            case ItemType.Nectar:

                NectarBottle bottle = (NectarBottle)GlobalFunctions.CreateObjectOutOfWorld("NectarBottle");
                NectarBottleObjectInitParams nectarBottleObjectInitParams = bottle.CreateAncientBottle(rItem.info.NectarAge, rItem.info.Price);

                if (nectarBottleObjectInitParams != null)
                {
                    bottle.mBottleInfo.FruitHash   = nectarBottleObjectInitParams.FruitHash;
                    bottle.mBottleInfo.Ingredients = nectarBottleObjectInitParams.Ingredients;
                    bottle.mBottleInfo.Name        = rItem.info.Name;             //nectarBottleObjectInitParams.Name;
                    bottle.mDateString             = nectarBottleObjectInitParams.DateString;
                    bottle.mBottleInfo.DateNum     = nectarBottleObjectInitParams.DateNum;
                    bottle.mBaseValue                   = rItem.info.Price;  // nectarBottleObjectInitParams.BaseValue;
                    bottle.ValueModifier                = (int)(nectarBottleObjectInitParams.CurrentValue - rItem.info.Price);
                    bottle.mBottleInfo.mCreator         = nectarBottleObjectInitParams.Creator;
                    bottle.mBottleInfo.NectarQuality    = Sims3.Gameplay.Objects.Quality.Neutral;                 //NectarBottle.GetQuality((float)rItem.info.Price);
                    bottle.mBottleInfo.MadeByLevel10Sim = nectarBottleObjectInitParams.MadeByLevel10Sim;
                    bottle.UpdateVisualState();
                }

                o = bottle;

                break;

            case ItemType.AlchemyPotion:

                foreach (AlchemyRecipe recipe in AlchemyRecipe.GetAllAwardPotionRecipes())
                {
                    if (rItem.info.Name.Equals(recipe.Name))
                    {
                        string[] array = new string[] { recipe.Key };

                        AlchemyRecipe randomAwardPotionRecipe = AlchemyRecipe.GetRandomAwardPotionRecipe();
                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterData potionShopConsignmentRegisterData = new PotionShopConsignmentRegister.PotionShopConsignmentRegisterData();

                        potionShopConsignmentRegisterData.mParameters             = array;
                        potionShopConsignmentRegisterData.mObjectName             = randomAwardPotionRecipe.MedatorName;
                        potionShopConsignmentRegisterData.mGuid                   = potionShopConsignmentRegisterData.mObjectName.GetHashCode();
                        potionShopConsignmentRegisterData.mSellerAge              = CASAgeGenderFlags.None;
                        potionShopConsignmentRegisterData.mWeight                 = 100f;
                        potionShopConsignmentRegisterData.mSellPriceMinimum       = 0.75f;
                        potionShopConsignmentRegisterData.mSellPriceMaximum       = 1.25f;
                        potionShopConsignmentRegisterData.mDepreciationAgeMinimum = 0;
                        potionShopConsignmentRegisterData.mDepreciationAgeMaximum = 5;
                        potionShopConsignmentRegisterData.mLifespan               = 3f;
                        string text = string.Empty;
                        if (!string.IsNullOrEmpty(randomAwardPotionRecipe.CustomClassName))
                        {
                            text = randomAwardPotionRecipe.CustomClassName;
                        }
                        else
                        {
                            text = "Sims3.Gameplay.Objects.Alchemy.AlchemyPotion";
                        }
                        potionShopConsignmentRegisterData.mScriptClass = text;
                        potionShopConsignmentRegisterData.mIsRotatable = true;

                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData potionShopConsignmentRegisterObjectData2 = PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData.Create(potionShopConsignmentRegisterData);
                        potionShopConsignmentRegisterObjectData2.ShowTooltip = true;

                        o = (GameObject)potionShopConsignmentRegisterObjectData2.mObject;


                        break;
                    }
                }

                break;

            case ItemType.Bug:
                Terrarium t = Terrarium.Create(rItem.info.BugType);
                if (t != null)
                {
                    t.StartVfx();
                }
                o = t;
                break;

            case ItemType.Food:
                int servingPrice = 25;
                if (register != null)
                {
                    servingPrice = register.Info.ServingPrice;
                }

                IFoodContainer container = rItem.info.cookingProcess.Recipe.CreateFinishedFood(rItem.info.cookingProcess.Quantity, rItem.info.cookingProcess.Quality);

                if (rItem.info.cookingProcess.Quantity == Recipe.MealQuantity.Group)
                {
                    ((ServingContainerGroup)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice * ((ServingContainerGroup)container).mNumServingsLeft);
                    ((ServingContainerGroup)container).RemoveSpoilageAlarm();
                }
                else
                {
                    ((ServingContainerSingle)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice);
                    ((ServingContainerSingle)container).RemoveSpoilageAlarm();
                }

                o = (GameObject)container;

                break;

            case ItemType.Flowers:
                o = Wildflower.CreateWildflowerOfType(rItem.info.TypeOfWildFlower, Wildflower.WildflowerState.InVase);
                break;

            case ItemType.BookAlchemyRecipe_:
            case ItemType.BookComic_:
            case ItemType.BookFish_:
            case ItemType.BookGeneral_:
            case ItemType.BookRecipe_:
            case ItemType.BookSkill_:
            case ItemType.BookToddler_:
            case ItemType.SheetMusic_:
            case ItemType.AcademicTextBook_:

                foreach (KeyValuePair <string, List <StoreItem> > kvp in Bookstore.sItemDictionary)
                {
                    foreach (StoreItem item in kvp.Value)
                    {
                        if (item.Name.Equals(rItem.info.Name))
                        {
                            keepLooping = false;

                            if (rItem.info.Type == ItemType.BookGeneral_)
                            {
                                o = (GameObject)BookGeneral.CreateOutOfWorld(item.CustomData as BookGeneralData);
                            }
                            if (rItem.info.Type == ItemType.BookSkill_)
                            {
                                o = (GameObject)BookSkill.CreateOutOfWorld(item.CustomData as BookSkillData);
                            }
                            if (rItem.info.Type == ItemType.BookRecipe_)
                            {
                                o = (GameObject)BookRecipe.CreateOutOfWorld(item.CustomData as BookRecipeData);
                            }
                            if (rItem.info.Type == ItemType.SheetMusic_)
                            {
                                o = (GameObject)SheetMusic.CreateOutOfWorld(item.CustomData as SheetMusicData);
                            }
                            if (rItem.info.Type == ItemType.BookToddler_)
                            {
                                o = (GameObject)BookToddler.CreateOutOfWorld(item.CustomData as BookToddlerData);
                            }
                            if (rItem.info.Type == ItemType.BookFish_)
                            {
                                o = (GameObject)BookFish.CreateOutOfWorld(item.CustomData as BookFishData);
                            }
                            if (rItem.info.Type == ItemType.BookAlchemyRecipe_)
                            {
                                o = (GameObject)BookAlchemyRecipe.CreateOutOfWorld(item.CustomData as BookAlchemyRecipeData);
                            }
                            if (rItem.info.Type == ItemType.AcademicTextBook_)
                            {
                                o = (GameObject)AcademicTextBook.CreateOutOfWorld(item.CustomData as AcademicTextBookData, actor);
                            }
                            if (rItem.info.Type == ItemType.BookComic_)
                            {
                                o = (GameObject)BookComic.CreateOutOfWorld(item.CustomData as BookComicData);
                            }

                            break;
                        }
                    }
                    if (!keepLooping)
                    {
                        break;
                    }
                }


                break;

            case ItemType.JamJar:
                JamJar jamJar = GlobalFunctions.CreateObjectOutOfWorld("canningJarJam", ProductVersion.Store) as JamJar;

                if (jamJar != null)
                {
                    Type         tInfo = jamJar.GetType();
                    BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
                    FieldInfo    ingredientDataField = tInfo.GetField("mData", flags);
                    FieldInfo    ingredientKeyField  = tInfo.GetField("mIngredientKey", flags);
                    FieldInfo    qualityField        = tInfo.GetField("mQuality", flags);
                    FieldInfo    preservesField      = tInfo.GetField("mIsPreserves", flags);
                    MethodInfo   materialStateMethod = tInfo.GetMethod("SetMaterialState", flags);

                    ingredientDataField.SetValue(jamJar, rItem.info.IngData);
                    ingredientKeyField.SetValue(jamJar, rItem.info.IngredientKey);
                    qualityField.SetValue(jamJar, rItem.info.JamQuality);
                    preservesField.SetValue(jamJar, rItem.info.JamIsPreserve);
                    materialStateMethod.Invoke(jamJar, null);
                }
                o = (GameObject)jamJar;
                break;

            default:
                break;
            }

            return(o);
        }
Пример #16
0
 public void TerrariumConstructortest()
 {
     testTerrarium = new Terrarium(4, 5);
     Assert.AreEqual(4, testTerrarium.Width);
     Assert.AreEqual(5, testTerrarium.Height);
 }
Пример #17
0
        void Del_bttn_Click(object sender, RoutedEventArgs e)
        {
            var          parent            = ((Button)sender).TemplatedParent;
            ComboBoxItem cmbx_SelectedItem = (ComboBoxItem)parent;
            ComboBox     cmbx_Parent       = ItemsControl.ItemsControlFromItemContainer(parent) as ComboBox;
            object       obj_SelectedItem  = cmbx_SelectedItem.Content;

            if (cmbx_Parent.ItemsSource is ObservableCollection <Terrarium_Group> )
            {
                ObservableCollection <Terrarium_Group> cmbx_Source = (ObservableCollection <Terrarium_Group>)cmbx_Parent.ItemsSource;

                Terrarium_Group cur_Group = (Terrarium_Group)obj_SelectedItem;

                for (int i = 0; i < cmbx_Source.Count; i++)
                {
                    if (cur_Group.ID == cmbx_Source[i].ID)
                    {
                        if (i == 0 && cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 1;
                        }
                        else if (cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 0;
                        }


                        cmbx_Source.RemoveAt(i);
                        cmbx_Parent.SelectedIndex = 0;
                    }
                }
            }

            if (cmbx_Parent.ItemsSource is ObservableCollection <Terrarium> )
            {
                ObservableCollection <Terrarium> cmbx_Source = (ObservableCollection <Terrarium>)cmbx_Parent.ItemsSource;

                Terrarium cur_Terrarium = (Terrarium)obj_SelectedItem;

                for (int i = 0; i < cmbx_Source.Count; i++)
                {
                    if (cur_Terrarium.Name == cmbx_Source[i].Name)
                    {
                        if (i == 0 && cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 1;
                        }
                        else if (cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 0;
                        }

                        cmbx_Source.RemoveAt(i);
                        cmbx_Parent.SelectedIndex = 0;
                    }
                }
            }

            if (cmbx_Parent.ItemsSource is ObservableCollection <Probe> )
            {
                ObservableCollection <Probe> cmbx_Source = (ObservableCollection <Probe>)cmbx_Parent.ItemsSource;

                Probe cur_Probe = (Probe)obj_SelectedItem;

                for (int i = 0; i < cmbx_Source.Count; i++)
                {
                    if (cur_Probe.Name == cmbx_Source[i].Name)
                    {
                        if (i == 0 && cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 1;
                        }
                        else if (cmbx_Source.Count > 1)
                        {
                            cmbx_Parent.SelectedIndex = 0;
                        }

                        cmbx_Source.RemoveAt(i);
                        cmbx_Parent.SelectedIndex = 0;
                    }
                }
            }
            //cmbx_Itemsource.RemoveAt(1);
        }
Пример #18
0
 public void Initialize()
 {
     BeginTerrarium = new Terrarium(3, 3);
     EindTerrarium  = BeginTerrarium;
 }