예제 #1
0
 public static void AddContract(LumberContract toAdd)
 {
     if (activeContracts.Count < PlayerSkills.GetMaxActiveContractsValue())
     {
         activeContracts.Add(toAdd);
     }
 }
예제 #2
0
    public static void GenerateNewContracts()
    {
        // Debug.Log("To Remove Count: " + contractsToRemove.Count);
        if (contractsToRemove.Count > 0)
        {
            for (int i = contractsToRemove.Count - 1; i >= 0; i--)
            {
                if (contractsToRemove[i] <= availableContracts.Count - 1)
                {
                    // Debug.Log("Remove Index: " + contractsToRemove[i] + " | Loop Index: " + i);
                    availableContracts.RemoveAt(contractsToRemove[i]);
                }
            }
            contractsToRemove.Clear();
        }

        totalNumberToDisplay = PlayerRooms.GetKitchenRoomValue();
        freeContractSpaces   = totalNumberToDisplay - availableContracts.Count;

        for (int j = 0; j < freeContractSpaces; j++)
        {
            int            difficulty = GenerateDifficulty();
            LumberContract toAdd      = new LumberContract(difficulty);

            // Debug.Log("C" + j + ": " + toAdd.GetDifficulty().difficulty + ", " + toAdd.GetDifficulty().GetQualityGradeInt());

            availableContracts.Add(toAdd);
        }

        if (SceneManager.GetActiveScene().name.Equals("MainCabin"))
        {
            AvailableContractsReference.PopulateCanvasObjcets();
        }
    }
예제 #3
0
 public int CompareByCompletion(LumberContract compareContract)
 {
     if (compareContract == null)
     {
         return(1);
     }
     else
     {
         return(this.CanBeCompleted().CompareTo(compareContract.CanBeCompleted()));
     }
 }
예제 #4
0
    public void SaveToPlayerContracts()
    {
        if (PlayerContracts.CanAdd())
        {
            string contractName   = EventSystem.current.currentSelectedGameObject.transform.parent.name;
            int    contractNumber = int.Parse(contractName.Substring(9));

            LumberContract toAdd = availableContracts[contractNumber - 1];
            PlayerContracts.AddContract(new LumberContract(toAdd.GetRequiredLumber(), toAdd.GetPayout(), toAdd.GetCompletionDeadline(), ContractStatus.ACTIVE, toAdd.GetDifficulty()));

            MarkContractForRemoval(contractNumber - 1, ContractStatus.ACTIVE);

            EventSystem.current.currentSelectedGameObject.transform.parent.GetChild(7).GetComponent <Button>().interactable = false;
            EventSystem.current.currentSelectedGameObject.GetComponent <Button>().interactable = false;

            //visually show contract has been accpeted (circle object)
        }
        else
        {
            //notify the player of full active contract inventory
        }
    }