示例#1
0
        public static void OnWorldLoadFinishedHandler(object sender, System.EventArgs e)
        {
            foreach (Plant p in Queries.GetObjects <Plant>())
            {
                //p.AddInteraction(EWPetMarkPlant.Singleton);
                p.AddInteraction(EWPetWatchPlant.Singleton);
                p.AddInteraction(EWPetHarvest.Singleton);
                p.AddInteraction(EWPetWeedPlant.Singleton);
                p.AddInteraction(EWPetWaterPlant.Singleton);
                p.AddInteraction(EWPetDisposePlant.Singleton);
            }

            foreach (GameObject p in Queries.GetObjects <GameObject>())
            {
                if (!(p.Plantable == null))
                {
                    p.AddInteraction(EWPetPickUpPlantable.Singleton);
                    p.AddInventoryInteraction(EWPetPlantSeed.Singleton);
                    p.AddInventoryInteraction(EWPetTreatNausea.Singleton);
                }
                if (p.CatHuntingComponent != null)
                {
                    if (p.CatHuntingComponent.mPreyData.PreyType == CatHuntingSkill.PreyType.Rodent)
                    {
                        p.AddInventoryInteraction(EWPetTreatFleas.Singleton);
                    }
                }

                Fish fish = p as Fish;
                if (fish != null)
                {
                    fish.AddInventoryInteraction(EWCarryFish.Singleton);
                }
            }

            EventTracker.AddListener(EventTypeId.kInventoryObjectAdded, new ProcessEventDelegate(OnObjectChanged));
            EventTracker.AddListener(EventTypeId.kObjectStateChanged, new ProcessEventDelegate(OnObjectChanged));
        }