コード例 #1
0
    /// <summary>
    /// Returns save data for current office state.
    /// </summary>
    /// <returns></returns>
    public OfficeCustomizationData GetCustomizationData()
    {
        OfficeCustomizationData data = new OfficeCustomizationData(MaterialWallsCurrent.color, MaterialWallsShopCurrent.color, MaterialFloorCurrent.color, MaterialCeilingCurrent.color);

        UnsetAllObjectParents();

        if (CurrentObjects.Count > 0)
        {
            OfficeItem officeItem;

            for (int i = 0; i < CurrentObjects.Count; i++)
            {
                GameObject         obj       = CurrentObjects[i];
                OfficeObjectScript objScript = obj.GetComponent <OfficeObjectScript>();

                if (objScript.OfficeItemID > -1)
                {
                    officeItem = new OfficeItem(objScript.OfficeItemID, obj.transform.position, obj.transform.rotation);
                }
                else
                {
                    officeItem = new OfficeItem(obj.name, obj.transform.position, obj.transform.rotation);
                }

                data.OfficeItems.Add(officeItem);

                if (objScript.ParentIndex != -1)
                {
                    data.Dependencies.Add(new OfficeObjectDependency(objScript.ObjectIndex, objScript.ParentIndex));
                }
            }

            //foreach (GameObject obj in CurrentObjects)
            //{
            //    OfficeObjectScript objScript = obj.GetComponent<OfficeObjectScript>();

            //    if (objScript.OfficeItemID > -1)
            //    {
            //        officeItem = new OfficeItem(objScript.OfficeItemID, obj.transform.position, obj.transform.rotation);
            //    }
            //    else
            //    {
            //        officeItem = new OfficeItem(obj.name, obj.transform.position, obj.transform.rotation);
            //    }

            //    data.OfficeItems.Add(officeItem);

            //    if (objScript.ParentIndex != -1)
            //    {
            //        data.Dependencies.Add(new OfficeObjectDependency(objScript.ObjectIndex, objScript.ParentIndex));
            //    }
            //}
        }

        ResetAllObjectParents();

        return(data);
    }
コード例 #2
0
    /// <summary>
    /// Sets up the office by using the specified customization data.
    /// </summary>
    /// <param name="customizationData"></param>
    public void SetUpOffice(OfficeCustomizationData data)
    {
        RemoveAllOfficeObjects();

        MaterialWallsCurrent.color   = data.GetWallsColor();
        MaterialFloorCurrent.color   = data.GetFloorColor();
        MaterialCeilingCurrent.color = data.GetCeilingColor();

        if (data.OfficeItems.Count > 0)
        {
            for (int i = 0; i < data.OfficeItems.Count; i++)
            {
                OfficeItem officeItem      = data.OfficeItems[i];
                GameObject newOfficeObject = null;

                if (officeItem.ItemID > -1)
                {
                    int iObject;

                    InitializeOfficeObject(officeItem.ItemID, out iObject);

                    newOfficeObject = CurrentObjects[iObject];
                }
                else
                {
                    foreach (GameObject obj in CurrentObjects)
                    {
                        if (obj.name == officeItem.ObjectName)
                        {
                            newOfficeObject = obj;
                            break;
                        }
                    }
                }

                newOfficeObject.transform.position = officeItem.GetPosition();
                newOfficeObject.transform.rotation = officeItem.GetRotation();
            }

            int iCurrentObjectsStart = 0;

            foreach (OfficeObjectDependency dependency in data.Dependencies)
            {
                for (int iCurrentObjects = iCurrentObjectsStart; iCurrentObjects < CurrentObjects.Count; iCurrentObjects++)
                {
                    OfficeObjectScript objScript = CurrentObjects[iCurrentObjects].GetComponent <OfficeObjectScript>();

                    if (objScript.ObjectIndex == dependency.ObjectIndexChild)
                    {
                        objScript.SetParent(dependency.ObjectIndexParent);

                        iCurrentObjectsStart++;
                        iCurrentObjects = CurrentObjects.Count; //break;
                    }
                }
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// Creates a NEW player. Default clothing unlocked and activated in customization data. Default Office items unlocked.
    /// </summary>
    public Player(string name, string businessName, float startingMoney, float initialMarkup, float maximumInventorySpace, int shopItemSlotCount)
    {
        Name = name;

        Business = new SupplierPlayer(businessName, startingMoney, initialMarkup, maximumInventorySpace, shopItemSlotCount);

        Level = 1;

        PlayTime = 0f;

        HasLifeLine = true;

        CharacterCustomizationData = new CharacterCustomizationData(GameMaster.Instance.CustomizationManager.Character.MaterialBodyDefault.color);
        UnlockedClothing           = new List <int>();
        PurchasedClothing          = new List <int>();

        OfficeCustomizationData = new OfficeCustomizationData(GameMaster.Instance.CustomizationManager.Office.MaterialWallsDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialWallsDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialFloorDefault.color, GameMaster.Instance.CustomizationManager.Office.MaterialCeilingDefault.color);
        UnlockedOfficeItems     = new List <int>();

        GetLevelUnlocks();

        foreach (int i in GameMaster.Instance.CustomizationManager.Character.DefaultClothingIndexes)
        {
            PurchasedClothing.Add(i);

            CharacterCustomizationData.AddClothingData(new CharacterClothing(i));
        }

        UnlockedAchievements = new List <int>();

        UnlockedUpgradesPassive = new List <int>();
        CurrentUpgradesActive   = new List <UpgradeActive>();

        ////TEMP:
        //for (int i = 1; i <= 20; i++)
        //    Debug.Log("Level " + i + ": " + GetLevelExperience(i));
    }