public void removeDumbObject(BaseTileObject tileObject) { locationList.Remove(tileObject.getObjectID()); scaleList.Remove(tileObject.getObjectID()); rotationList.Remove(tileObject.getObjectID()); dumbObjectsList.Remove(tileObject); setDirty(); }
//Add a tileobject to the gridview and in the world public void AddTileObject(BaseTileObject tileObject) { if (tileObject != null) { //Debug.Log("Adding a tileobject current size = " + indexTracker.Count + " and added id is " + tileObject.getObjectID()); string key = standartKeyName + tileObject.getObjectID(); //Debug.Log("Added a new key: " + key); int id = tileObject.getObjectID(); Debug.Log("Trying to get id: " + id); foreach (KeyValuePair <string, BaseTileObject> a in objectTracker) { Debug.Log("Key: " + a.Key); } if (!objectTracker.ContainsKey(key)) { //print("Did not exists"); objectTracker.Add(key, tileObject); indexTracker.Add(key, id); InstantiateObject(tileObject, id); //InstantiateObject(tileObject.getPrefab().gameObject, id); print("1 :" + selectedTile); print("2 :" + selectedTile.tileGameObject); print("3 :" + tileObjects); selectedTile.AddPosition(id, selectedTile.tileGameObject.position); selectedTile.AddScale(id, new Vector3(1, 1, 1)); selectedTile.AddRotation(id, new Quaternion()); TileRenderer.instance.updateTile(selectedTile); //TODO should be handled better tileObjects.Clear(); foreach (KeyValuePair <string, BaseTileObject> entry in objectTracker) { tileObjects.Add(entry.Value); } selectedTile.UpdateList(tileObjects, GetElevation(), GetWalkable(), terrain); } else { print("Already exists"); } } else { throw new System.Exception("Null tile object"); } }
public void addDumbObject(BaseTileObject tileObject, Vector3 position, Quaternion rotation, Vector3 scale) { AddPosition(tileObject.getObjectID(), position); AddRotation(tileObject.getObjectID(), rotation); AddScale(tileObject.getObjectID(), scale); //Debug.Log("Adding new object with id : " + tileObject.getObjectID()); //if (!tileObject.getInteractable()) { dumbObjectsList.Add(tileObject); } //else { //Debug.LogError("Someone tried to set a interactable object as a dumb object of the tile :" + this); } setDirty(); }
public void setInteractableObject(BaseTileObject tileObject) { if (tileObject.getInteractable()) { interactableObject = tileObject; } else { Debug.LogError("Someone tried to set a non interactable object as the interactable object (" + tileObject.getObjectID() + ") of the tile :" + this); } }
public void setInteractableObject(BaseTileObject tileObject) { //Debug.Log("THis created a bugged tile so disabling it for now"); return; if (tileObject.getInteractable()) { interactableObject = tileObject; } else { Debug.LogError("Someone tried to set a non interactable object as the interactable object (" + tileObject.getObjectID() + ") of the tile :" + this); } }