/// @return The serialized data /// public object Serialize() { var jsonData = new JsonDictionary() { { k_keyType, m_type.ToString() } }; if (m_type == ObjectiveType.Chain && m_value > 0) { jsonData.Add(k_keyValue, m_value); } if (m_type == ObjectiveType.Colour && m_target != TileColour.None) { jsonData.Add(k_keyTarget, m_target.ToString()); } if (m_amount > 0) { jsonData.Add(k_keyAmount, m_amount); } return(jsonData); }
/// @param colour /// The colour of tile to set /// @param tileView /// The view of the tile to set /// public void SetColourForTile(TileColour colour, TileView tileView) { // Create the requested colour item var colourObject = ResourceUtils.LoadAndInstantiateGameObject(string.Format(k_colourPrefabPath, colour.ToString())); // Link the two var tileItem = colourObject.GetComponent <TileItemView>(); tileView.m_tileColour = colour; tileItem.transform.SetParent(tileView.TileItemHolder, false); tileView.m_tileItem = tileItem; }
/// @param colour /// The colour of tile to create /// @param parent /// The parent object of the room /// @param position /// The position of the tile /// /// @return The view of the newly created tile /// public TileView CreateTile(TileColour colour, Transform parent, Vector3 position) { // Create the tile holder var tileObject = ResourceUtils.LoadAndInstantiateGameObject(k_tilePrefabPath, parent, colour.ToString()); var tileView = tileObject.GetComponent <TileView>(); tileObject.transform.position = position; // Set the colour of that tile SetColourForTile(colour, tileView); return(tileView); }