Ejemplo n.º 1
0
 public void LeaveRoom()
 {
     TriggerExitAction();
     currentLocation = null;
     currentRoom     = null;
     onLocationUpdated();
 }
Ejemplo n.º 2
0
 private void CleanDanglingChildren(RoomLocation nodeToDelete)
 {
     foreach (RoomLocation node in GetAllLocations())
     {
         node.RemoveChild(nodeToDelete.name);
     }
 }
Ejemplo n.º 3
0
 public void StartRoom(Room newRoom)
 {
     currentRoom     = newRoom;
     currentLocation = currentRoom.GetRootNode();
     TriggerEnterAction();
     onLocationUpdated();
 }
Ejemplo n.º 4
0
 public void DeleteNode(RoomLocation nodeToDelete)
 {
     Undo.RecordObject(this, "Delete Node");
     locations.Remove(nodeToDelete);
     OnValidate();
     CleanDanglingChildren(nodeToDelete);
     Undo.DestroyObjectImmediate(nodeToDelete);
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public IEnumerable <RoomLocation> GetAIChildren(RoomLocation currentLocation)
 {
     foreach (RoomLocation location in GetAllLocations(currentLocation))
     {
         if (!location.IsLocationChild())
         {
             yield return(location);
         }
     }
 }
Ejemplo n.º 7
0
 public IEnumerable <RoomLocation> GetPlayerChildren(RoomLocation currentNode)
 {
     foreach (RoomLocation node in GetAllLocations(currentNode))
     {
         if (node.IsLocationChild())
         {
             yield return(node);
         }
     }
 }
Ejemplo n.º 8
0
 public IEnumerable <RoomLocation> GetAllLocations(RoomLocation parentNode)
 {
     foreach (string childID in parentNode.GetLocation())
     {
         if (locationLookup.ContainsKey(childID))
         {
             yield return(locationLookup[childID]);
         }
     }
 }
Ejemplo n.º 9
0
        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;
            }
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 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);
             }
         }
     }
 }
Ejemplo n.º 12
0
 public void SelectMove(RoomLocation chosenLocation)
 {
     currentLocation = chosenLocation;
     //isMoving = true;
     //TriggerEnterAction();
 }
Ejemplo n.º 13
0
 private void AddNode(RoomLocation childNode)
 {
     locations.Add(childNode);
     OnValidate();
 }