Example #1
0
 /// <summary>
 /// Adds a HistoryObject to the History if no Object exsists for the Guid
 /// </summary>
 /// <param name="historyObject">HistoryObject to add</param>
 public void AddHistoryEntry(HistoryObject historyObject)
 {
     if (!blockPlacingHistory.Exists(historyObjectTemp => historyObject.guid == historyObjectTemp.guid))
     {
         blockPlacingHistory.Add(historyObject);
     }
 }
Example #2
0
        /// <summary>
        /// Adds the Block to the History of placed Blocks
        /// </summary>
        private void AddGuidToHistory()
        {
            int           timeStamp     = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            HistoryObject historyObject = new HistoryObject(blockCommunication.Guid, timeStamp);

            BlockManager blockManager = GameObject.FindGameObjectWithTag("BlockManager").GetComponent <BlockManager>();

            blockManager.AddHistoryEntry(historyObject);
            blockManager.ResetHistoryStack();
        }
Example #3
0
        /// <summary>
        /// Loads a BlockSave from a given HistoryObject and SaveGame
        /// </summary>
        /// <param name="save">The SaveGame containing the BlockSave</param>
        /// <param name="historyObject">The HistoryObject to load</param>
        public void LoadBlock(SaveGame save, HistoryObject historyObject)
        {
            BlockSave blockSave = save.GetBlockSaveByGuid(historyObject.guid);

            LoadBlock(blockSave);
        }