public static void SetLogicData(LogicJSONObject jsonObject, string key, LogicData value)
 {
     if (value != null)
     {
         jsonObject.Put(key, new LogicJSONString(value.GetGlobalID().ToString()));
     }
     else
     {
         Debugger.Error("Unable to set null data. key:" + key);
     }
 }
        /// <summary>
        ///     Creates a gameobject with specified data.
        /// </summary>
        public static LogicGameObject CreateGameObject(LogicData data, LogicLevel level, int villageType)
        {
            LogicGameObject gameObject = null;

            switch (data.GetDataType())
            {
            case 0:
                gameObject = new LogicBuilding(data, level, villageType);
                break;

            case 3:
                gameObject = new LogicCharacter(data, level, villageType);
                break;

            case 7:
                gameObject = new LogicObstacle(data, level, villageType);
                break;

            case 11:
                gameObject = new LogicTrap(data, level, villageType);
                break;

            case 25:
                gameObject = new LogicSpell(data, level, villageType);
                break;

            case 38:
                gameObject = new LogicVillageObject(data, level, villageType);
                break;

            default:
            {
                Debugger.Warning("Trying to create game object with data that does not inherit LogicGameObjectData. GlobalId=" + data.GetGlobalID());
                break;
            }
            }

            return(gameObject);
        }
 public static void WriteDataReference(ChecksumEncoder encoder, LogicData data)
 {
     encoder.WriteInt(data != null ? data.GetGlobalID() : 0);
 }