public string GetDescription(CommonEnums.Interactables item, CommonEnums.LocationType currentLocation)
        {
            string description = "That item is nowhere to be found";

            if (DoesObjectExistInScene(item, currentLocation))
            {
                switch (item)
                {
                case CommonEnums.Interactables.Desk:
                    description = Desk.Description();
                    break;

                case CommonEnums.Interactables.Note:
                    description = Note.Description;
                    break;

                case CommonEnums.Interactables.Cup:
                    description = Cup.Description;
                    break;

                case CommonEnums.Interactables.Charlie:
                    description = Charlie.Description;
                    break;

                case CommonEnums.Interactables.Chair:
                    description = Chair.Description;
                    break;

                case CommonEnums.Interactables.Pen:
                    description = Pen.Description;
                    break;
                }
            }
            return(description);
        }
        public void AddItemToScene(CommonEnums.Interactables item, CommonEnums.LocationType currentLocation)
        {
            switch (item)
            {
            case CommonEnums.Interactables.Desk:
                Desk.RoomLocation = currentLocation;
                break;

            case CommonEnums.Interactables.Note:
                Note.RoomLocation = currentLocation;
                break;

            case CommonEnums.Interactables.Cup:
                Cup.RoomLocation = currentLocation;
                break;

            case CommonEnums.Interactables.Charlie:
                Charlie.RoomLocation = currentLocation;
                break;

            case CommonEnums.Interactables.Chair:
                Chair.RoomLocation = currentLocation;
                break;

            case CommonEnums.Interactables.Pen:
                Pen.RoomLocation = currentLocation;
                break;
            }
        }
Ejemplo n.º 3
0
        //Returns the description of a location object
        public string GetDescription(CommonEnums.LocationType location)
        {
            switch (location)
            {
            case CommonEnums.LocationType.Office:
                return(Office.Description);

            case CommonEnums.LocationType.Hallway:
                return(Hallway.Description);
            }
            return("Location Manager out of Sync with locations");
        }
Ejemplo n.º 4
0
 public string Look(CommonEnums.LocationType location)
 {
     if (location == CommonEnums.LocationType.None)
     {
         return(Locations.GetDescription(Player.Location));
     }
     else if (location == CommonEnums.LocationType.Inventory)
     {
         return(Player.PlayerInventory());
     }
     else
     {
         return(Locations.GetDescription(location));
     }
 }
Ejemplo n.º 5
0
        public bool isDirection(CommonEnums.LocationType currentLocation, CommonEnums.Direction direction)
        {
            bool isPath = false;

            switch (currentLocation)
            {
            case CommonEnums.LocationType.Office:
                isPath = Office.Pathways.ContainsKey(direction);
                break;

            case CommonEnums.LocationType.Hallway:
                isPath = Hallway.Pathways.ContainsKey(direction);
                break;
            }
            return(isPath);
        }
Ejemplo n.º 6
0
        //Returns the contents of a location object
        public List <CommonEnums.Interactables> GetContents(CommonEnums.LocationType location)
        {
            List <CommonEnums.Interactables> contents = new List <CommonEnums.Interactables>();

            switch (location)
            {
            case CommonEnums.LocationType.Office:
                contents = Office.Contains;
                break;

            case CommonEnums.LocationType.Hallway:
                contents = Hallway.Contains;
                break;
            }
            return(contents);
        }
Ejemplo n.º 7
0
        public CommonEnums.LocationType DirectionToLocation(CommonEnums.LocationType currentLocation, CommonEnums.Direction direction)
        {
            CommonEnums.LocationType location = currentLocation;
            if (isDirection(currentLocation, direction))
            {
                switch (currentLocation)
                {
                case CommonEnums.LocationType.Office:
                    Office.Pathways.TryGetValue(direction, out location);
                    break;

                case CommonEnums.LocationType.Hallway:
                    Hallway.Pathways.TryGetValue(direction, out location);
                    break;
                }
            }
            return(location);
        }
Ejemplo n.º 8
0
        public void RemoveContents(CommonEnums.LocationType currentLocation, CommonEnums.Interactables item)
        {
            List <CommonEnums.Interactables> contents = GetContents(currentLocation);

            if (contents.Remove(item))
            {
                switch (currentLocation)
                {
                case CommonEnums.LocationType.Office:
                    Office.Contains.Clear();
                    Office.Contains = contents;
                    break;

                case CommonEnums.LocationType.Hallway:
                    Hallway.Contains.Clear();
                    Hallway.Contains = contents;
                    break;
                }
            }
        }
        private bool CanPickupItem(CommonEnums.Interactables item, CommonEnums.LocationType currentLocation)
        {
            bool status = false;
            int  Size   = 0;

            //Get size of item to carry and the location of the item
            switch (item)
            {
            case CommonEnums.Interactables.Desk:
                Size = (int)Desk.Size;
                break;

            case CommonEnums.Interactables.Note:
                Size = (int)Note.Size;
                break;

            case CommonEnums.Interactables.Cup:
                Size = (int)Cup.Size;
                break;

            case CommonEnums.Interactables.Charlie:
                Size = (int)Charlie.Size;
                break;

            case CommonEnums.Interactables.Chair:
                Size = (int)Chair.Size;
                break;

            case CommonEnums.Interactables.Pen:
                Size = (int)Pen.Size;
                break;
            }
            //If item is too big, deny
            if (Size < 2 && DoesObjectExistInScene(item, currentLocation))
            {
                status = true;
            }
            return(status);
        }
Ejemplo n.º 10
0
 public void SetLocation(CommonEnums.LocationType location)
 {
     CurrentLocation = location;
 }
        private bool DoesObjectExistInScene(CommonEnums.Interactables item, CommonEnums.LocationType location)
        {
            switch (item)
            {
            case CommonEnums.Interactables.Desk:
                if (Desk.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommonEnums.Interactables.Note:
                if (Note.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommonEnums.Interactables.Cup:
                if (Cup.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommonEnums.Interactables.Charlie:
                if (Charlie.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommonEnums.Interactables.Chair:
                if (Chair.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            case CommonEnums.Interactables.Pen:
                if (Pen.RoomLocation == location)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }
        public void RemoveItemFromScene(CommonEnums.Interactables item, CommonEnums.LocationType currentLocation, out string error)
        {
            error = "The item you are looking for is not there.";
            bool canRemove = CanPickupItem(item, currentLocation);

            if (canRemove)
            {
                CommonEnums.Interactables nestedObject = CommonEnums.Interactables.None;
                switch (item)
                {
                case CommonEnums.Interactables.Desk:
                    Desk.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject        = Desk.ObjectLocation;
                    Desk.ObjectLocation = CommonEnums.Interactables.None;
                    break;

                case CommonEnums.Interactables.Note:
                    Note.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject        = Note.ObjectLocation;
                    Note.ObjectLocation = CommonEnums.Interactables.None;
                    break;

                case CommonEnums.Interactables.Cup:
                    Cup.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject       = Cup.ObjectLocation;
                    Cup.ObjectLocation = CommonEnums.Interactables.None;
                    break;

                case CommonEnums.Interactables.Charlie:
                    Charlie.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject           = Charlie.ObjectLocation;
                    Charlie.ObjectLocation = CommonEnums.Interactables.None;
                    break;

                case CommonEnums.Interactables.Chair:
                    Chair.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject         = Chair.ObjectLocation;
                    Chair.ObjectLocation = CommonEnums.Interactables.None;
                    break;

                case CommonEnums.Interactables.Pen:
                    Pen.RoomLocation   = CommonEnums.LocationType.Inventory;
                    nestedObject       = Pen.ObjectLocation;
                    Pen.ObjectLocation = CommonEnums.Interactables.None;
                    break;
                }
                switch (nestedObject)
                {
                case CommonEnums.Interactables.Desk:
                    Desk.Contains.Remove(item);
                    break;

                case CommonEnums.Interactables.Note:
                    Note.Contains.Remove(item);
                    break;

                case CommonEnums.Interactables.Cup:
                    Cup.Contains.Remove(item);
                    break;

                case CommonEnums.Interactables.Charlie:
                    Charlie.Contains.Remove(item);
                    break;

                case CommonEnums.Interactables.Chair:
                    Chair.Contains.Remove(item);
                    break;

                case CommonEnums.Interactables.Pen:
                    Pen.Contains.Remove(item);
                    break;
                }
                error = null;
            }
        }
        public void PutItemOnObject(CommonEnums.Interactables item, CommonEnums.Interactables destination, CommonEnums.LocationType currentLocation, out string error)
        {
            error = "I don't know how to do that";
            if (item != CommonEnums.Interactables.None && destination != CommonEnums.Interactables.None)
            {
                error = "This item is too large for that action.";
                bool canPut = CanPutOnObject(item, destination, currentLocation);
                if (canPut)
                {
                    switch (item)
                    {
                    case CommonEnums.Interactables.Desk:
                        Desk.ObjectLocation = destination;
                        Desk.RoomLocation   = currentLocation;
                        break;

                    case CommonEnums.Interactables.Note:
                        Note.ObjectLocation = destination;
                        Note.RoomLocation   = currentLocation;
                        break;

                    case CommonEnums.Interactables.Cup:
                        Cup.ObjectLocation = destination;
                        Cup.RoomLocation   = currentLocation;
                        break;

                    case CommonEnums.Interactables.Charlie:
                        Charlie.ObjectLocation = destination;
                        Charlie.RoomLocation   = currentLocation;
                        break;

                    case CommonEnums.Interactables.Chair:
                        Chair.ObjectLocation = destination;
                        Chair.RoomLocation   = currentLocation;
                        break;

                    case CommonEnums.Interactables.Pen:
                        Pen.ObjectLocation = destination;
                        Pen.RoomLocation   = currentLocation;
                        break;
                    }

                    switch (destination)
                    {
                    case CommonEnums.Interactables.Desk:
                        Desk.Contains.Add(item);
                        break;

                    case CommonEnums.Interactables.Note:
                        Note.Contains.Add(item);
                        break;

                    case CommonEnums.Interactables.Cup:
                        Cup.Contains.Add(item);
                        break;

                    case CommonEnums.Interactables.Charlie:
                        Charlie.Contains.Add(item);
                        break;

                    case CommonEnums.Interactables.Chair:
                        Chair.Contains.Add(item);
                        break;

                    case CommonEnums.Interactables.Pen:
                        Pen.Contains.Add(item);
                        break;
                    }

                    error = "The " + destination.ToString().ToLower() + " now contains a " + item.ToString().ToLower();
                }
            }
            else
            {
                if (item == CommonEnums.Interactables.None && destination != CommonEnums.Interactables.None)
                {
                    error = "What would you like to put in the " + destination.ToString().ToLower() + "?";
                }
                if (item != CommonEnums.Interactables.None && destination == CommonEnums.Interactables.None)
                {
                    error = "Where do you want to place the " + item.ToString().ToLower() + "?";
                }
            }
        }
        private bool CanPutOnObject(CommonEnums.Interactables item, CommonEnums.Interactables destination, CommonEnums.LocationType currentLocation)
        {
            bool status          = false;
            int  ItemSize        = 0;
            int  DestinationSize = 0;

            //Get size and location of item to place
            switch (item)
            {
            case CommonEnums.Interactables.Desk:
                ItemSize = (int)Desk.Size;
                break;

            case CommonEnums.Interactables.Note:
                ItemSize = (int)Note.Size;
                break;

            case CommonEnums.Interactables.Cup:
                ItemSize = (int)Cup.Size;
                break;

            case CommonEnums.Interactables.Charlie:
                ItemSize = (int)Charlie.Size;
                break;

            case CommonEnums.Interactables.Chair:
                ItemSize = (int)Chair.Size;
                break;

            case CommonEnums.Interactables.Pen:
                ItemSize = (int)Pen.Size;
                break;
            }
            //Get size and location of item to place first item on
            switch (destination)
            {
            case CommonEnums.Interactables.Desk:
                DestinationSize = (int)Desk.Size;
                break;

            case CommonEnums.Interactables.Note:
                DestinationSize = (int)Note.Size;
                break;

            case CommonEnums.Interactables.Cup:
                DestinationSize = (int)Cup.Size;
                break;

            case CommonEnums.Interactables.Charlie:
                DestinationSize = (int)Charlie.Size;
                break;

            case CommonEnums.Interactables.Chair:
                DestinationSize = (int)Chair.Size;
                break;

            case CommonEnums.Interactables.Pen:
                DestinationSize = (int)Pen.Size;
                break;
            }
            //If the item is too large for the destination, deny
            if (ItemSize < DestinationSize && DoesObjectExistInScene(item, currentLocation) && DoesObjectExistInScene(destination, currentLocation))
            {
                status = true;
            }

            return(status);
        }
Ejemplo n.º 15
0
 public Player(CommonEnums.LocationType initialLocation)
 {
     Inventory = new InventoryManager();
     SetLocation(initialLocation);
 }
Ejemplo n.º 16
0
 public string Go(CommonEnums.LocationType location)
 {
     Player.SetLocation(location);
     return(Locations.GetDescription(Player.Location));
 }