Exemplo n.º 1
0
    // helper function for incrementDay
    private void initMail(int storyID)
    {
        // update daysBeforeDeliver
        daysBeforeDeliver[storyID] = -1;

        // update latestMailWaiting
        latestMailWaiting[storyID]++;

        // actually init the mail
        string currMailID = getMailIDString(storyID, latestMailWaiting[storyID]);
        Mail   currMail   = mailDb.getMailByID(currMailID);

        Debug.Log(currMail.getFromHouseID());
        House currHouse = houseDb.getHouseByID(currMail.getFromHouseID());

        currHouse.addMail(currMailID);
    }
Exemplo n.º 2
0
    // returns house response
    // TODO: add interesting responses per house
    public string pickupMail(string houseID)
    {
        // check for valid houseID
        if (!houseDb.isValidHouse(houseID))
        {
            throw new System.Exception("Dashboard: pickupMail() _ invalid houseID");
        }
        House house = houseDb.getHouseByID(houseID);

        // check house has mail
        if (!house.checkHasMailToSend())
        {
            if (DASHBOARD_DEBUG)
            {
                Debug.Log("Dashboard: house " + houseID + " does not have mail to deliver");
            }
            return("Sorry, I don't have any mail for you!");
        }
        else
        {
            List <string> houseMail = house.pickupMailToSend();
            for (int i = 0; i < houseMail.Count; i++)
            {
                string mailID = houseMail [i];
                Mail   mail   = mailDb.getMailByID(mailID);
                mail.setPicked();
                mailBeingHeld.Add(mailID);
                if (DASHBOARD_DEBUG)
                {
                    Debug.Log("Dashboard: picked up mail with ID " + mailID + " from house " + houseID);
                }
            }

            if (mailHeldChanged != null)
            {
                mailHeldChanged(mailBeingHeld);
            }
            return("Yay, it's the mailman!");
        }
    }