public void AddPlaceableData(PlaceableData placeableData) { placeableData.ID = totalCreatedObjects; Placeables.Add(placeableData); totalCreatedObjects++; }
public Placeable CreateNewPlaceable(PlaceableData data, GardenNode pos) { Placeable newplace = null; if (data) { GameObject pref = null; switch (data.placeableType) { case PlaceableData.ePlaceableType.DECORATION: pref = decorationPlaceablePrefab; break; case PlaceableData.ePlaceableType.HOME: pref = homePlaceablePrefab; break; case PlaceableData.ePlaceableType.GENERATOR: pref = generatorPlaceablePrefab; break; } newplace = Instantiate(pref, pos.transform.position, Quaternion.Euler(0, Random.value * (360f), 0), WorldManager.Instance.WorldParent.transform).GetComponent <Placeable>(); if (newplace) { newplace.placeableData = data; newplace.nodeOccupied = pos; pos.occupied = newplace; } } return(newplace); }
private bool isKey(PlaceableData pData) { if (pData.typeStr == "Key") { return(true); } return(false); }
public PlaceableData GetPlaceableData(string PlaceableName) { PlaceableData p = placeableDatas.Where(e => e.plotName.Contains(PlaceableName)).FirstOrDefault(); if (!p) { Debug.Log("Could not find Placeable with name:" + PlaceableName); } return(p); }
public void SerializerConfig_PlaceableFileData_ShouldBeEqual() { PlaceableData data = new PlaceableData { AutoRemoveKey = true, Comment = "it's a comment", Description = "it's a description", IsKeyRequired = true, IsLocked = true, IsPlot = true, IsStatic = true, IsUseable = true, KeyTag = "key tag 1", Name = "it's a name", OnAttacked = "onattacked script", OnClosed = "onclosed script", OnDamaged = "ondamaged script", OnDeath = "ondeath script", OnDisturbed = "ondisturbed script", OnHeartbeat = "onheartbeat script", OnLocked = "onlocked script", OnOpened = "onopened script", OnUnlocked = "onunlocked script", OnUsed = "onused script", Resref = "it's a resref", Tag = "it's a tag" }; PlaceableData result; using (MemoryStream stream = new MemoryStream()) { Serializer.Serialize(stream, data); stream.Position = 0; result = Serializer.Deserialize <PlaceableData>(stream); } Assert.IsTrue(_compareLogic.Compare(data, result).AreEqual); }
/// <inheritdoc /> public void AddOrUpdateDirty(PlaceableData data) { DirtyPlaceables.Remove(data.GlobalID); DirtyPlaceables.Add(data.GlobalID, data, ActionType.AddOrChanged); }
/// <inheritdoc /> public void MarkForDeletion(PlaceableData data) { DirtyPlaceables.Remove(data.GlobalID); DirtyPlaceables.Add(data.GlobalID, data, ActionType.Delete); }
public void PlaceableData_OnInstantiate_ShouldCreateGlobalID() { PlaceableData data = new PlaceableData(); Assert.IsTrue(!string.IsNullOrWhiteSpace(data.GlobalID)); }
public void PlaceableData_OnInstantiate_ShouldCreateLocalVariables() { PlaceableData data = new PlaceableData(); Assert.IsNotNull(data.LocalVariables); }
public void RemovePlaceableData(PlaceableData placeableData) { Placeables.Remove(placeableData); }
public void SetData(PlaceableData placeableData) { this._placeableData = placeableData; }
public void SetData(PlaceableData keyData) { this.pData = keyData; }
public void RemoveSeed(PlaceableData newPlot) { seeds[newPlot]--; }
public void AddUnlockedPlot(PlaceableData newPlot) { seeds[newPlot]++; }