Ejemplo n.º 1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="town">The town to search.</param>
 /// <param name="tile">The machine's position in its location.</param>
 /// <param name="trashCanIndex">The trash can index.</param>
 /// <param name="reflection">Simplifies access to private game code.</param>
 public TrashCanMachine(Town town, Vector2 tile, int trashCanIndex, IReflectionHelper reflection)
 {
     this.Tile             = tile;
     this.TrashCansChecked = reflection.GetPrivateValue <bool[]>(town, "garbageChecked");
     if (trashCanIndex > 0 && trashCanIndex < this.TrashCansChecked.Length)
     {
         this.TrashCanIndex = trashCanIndex;
     }
 }
Ejemplo n.º 2
0
        /****
        ** Sprite batch
        ****/
        /// <summary>Get whether the sprite batch is between a begin and end pair.</summary>
        /// <param name="spriteBatch">The sprite batch to check.</param>
        /// <param name="reflection">The reflection helper with which to access private fields.</param>
        public static bool IsOpen(this SpriteBatch spriteBatch, IReflectionHelper reflection)
        {
            // get field name
            const string fieldName =
#if SMAPI_FOR_WINDOWS
                "inBeginEndPair";
#else
                "_beginCalled";
#endif

            // get result
            return(reflection.GetPrivateValue <bool>(Game1.spriteBatch, fieldName));
        }