public void LeaveRoom() { TriggerExitAction(); currentLocation = null; currentRoom = null; onLocationUpdated(); }
private void CleanDanglingChildren(RoomLocation nodeToDelete) { foreach (RoomLocation node in GetAllLocations()) { node.RemoveChild(nodeToDelete.name); } }
public void StartRoom(Room newRoom) { currentRoom = newRoom; currentLocation = currentRoom.GetRootNode(); TriggerEnterAction(); onLocationUpdated(); }
public void DeleteNode(RoomLocation nodeToDelete) { Undo.RecordObject(this, "Delete Node"); locations.Remove(nodeToDelete); OnValidate(); CleanDanglingChildren(nodeToDelete); Undo.DestroyObjectImmediate(nodeToDelete); }
public void CreateLocation(RoomLocation parent, string location) { //Need to go through this line by line to see if duplicate directions can be prevented... RoomLocation childNode = MakeNode(parent, location); Undo.RegisterCreatedObjectUndo(childNode, "Created Dialogue Node"); Undo.RecordObject(this, "Added Dialogue Node"); AddNode(childNode); }
public IEnumerable <RoomLocation> GetAIChildren(RoomLocation currentLocation) { foreach (RoomLocation location in GetAllLocations(currentLocation)) { if (!location.IsLocationChild()) { yield return(location); } } }
public IEnumerable <RoomLocation> GetPlayerChildren(RoomLocation currentNode) { foreach (RoomLocation node in GetAllLocations(currentNode)) { if (node.IsLocationChild()) { yield return(node); } } }
public IEnumerable <RoomLocation> GetAllLocations(RoomLocation parentNode) { foreach (string childID in parentNode.GetLocation()) { if (locationLookup.ContainsKey(childID)) { yield return(locationLookup[childID]); } } }
private void ChildNodeFunctions(string location, RoomLocation childNode) { switch (location) { case "South": childNode.SetSouthConnection(true); NewNodeOffset(0f, -300f); break; case "West": childNode.SetWestConnection(true); NewNodeOffset(600f, 0f); break; case "North": childNode.SetNorthConnection(true); NewNodeOffset(0f, 300f); break; case "East": childNode.SetEastConnection(true); NewNodeOffset(-600f, 0f); break; case "NorthEast": childNode.SetNorthEastSouthWestConnection(true); NewNodeOffset(-400f, 200f); break; case "NorthWest": childNode.SetNorthWestSouthEastConnection(true); NewNodeOffset(400f, 200f); break; case "SouthEast": childNode.SetSouthEastNorthWestConnection(true); NewNodeOffset(-400f, -200f); break; case "SouthWest": childNode.SetSouthWestNorthEastConnection(true); NewNodeOffset(400f, -200f); break; default: break; } }
private RoomLocation MakeNode(RoomLocation parent, string location) { RoomLocation childNode = CreateInstance <RoomLocation>(); ChildNodeFunctions(location, childNode); childNode.name = Guid.NewGuid().ToString(); if (parent != null) { parent.AddChild(childNode.name); //could potentially put the backwards connection here... childNode.AddChild(parent.name); //childNode.SetLocationChild(!parent.IsLocationChild()); childNode.SetPosition(parent.GetRect().position + newNodeOffset); } return(childNode); }
public void OnBeforeSerialize() { if (locations.Count == 0) { RoomLocation childNode = MakeNode(null, null); childNode.MovementDirections().Clear(); AddNode(childNode); } if (AssetDatabase.GetAssetPath(this) != "") { foreach (RoomLocation node in GetAllLocations()) { if (AssetDatabase.GetAssetPath(node) == "") { AssetDatabase.AddObjectToAsset(node, this); } } } }
public void SelectMove(RoomLocation chosenLocation) { currentLocation = chosenLocation; //isMoving = true; //TriggerEnterAction(); }
private void AddNode(RoomLocation childNode) { locations.Add(childNode); OnValidate(); }