// Use this for initialization void Start() { // headband1 = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/HeadBand/Button").GetComponent<Button>(); // armL = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/ArmL/Button").GetComponent<Button>(); // armR = transform.Find("AccessoriesPanel/Scroll View/Viewport/Content/ArmR/Button").GetComponent<Button>(); // // shirtLong = transform.Find("UpperPanel/Scroll View/Viewport/Content/shirt1/Button").GetComponent<Button>(); // // pantsLong = transform.Find("LegsPanel/Scroll View/Viewport/Content/PantsLong/Button").GetComponent<Button>(); // // onesie = transform.Find("OutfitsPanel/Scroll View/Viewport/Content/onesie/Button").GetComponent<Button>(); // // headband1.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(2,ClothingSlot.Head);}); // armL.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(0,ClothingSlot.LeftArm);}); // armR.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(1,ClothingSlot.RightArm);}); // // shirtLong.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(5,ClothingSlot.Upper);}); // pantsLong.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(4,ClothingSlot.Lower);}); // onesie.GetComponent<Button>().onClick.AddListener(delegate {SetClothing(3,ClothingSlot.Costume);}); // playerCus = GameMaster.Instance.CurrentPlayerObject.GetComponent <CharacterCustomizationScript> (); colour = transform.Find("Refresh").GetComponent <ColourPicker> (); CurrentOutfit(); AddUpper(); shelf.SetBool("Shelf1", true); }
/// <summary> /// Sets a reference to the parent script and creates a copy of the clothing slot material to be used, if needed. /// </summary> /// <param name="parentScript"></param> public void Initialize(CharacterCustomizationScript parentScript) { this.parentScript = parentScript; if (!IsBodyObject) { currentClothingMaterial = new Material(GameMaster.Instance.CustomizationManager.Character.GetClothingSlotSO(ClothingSlot).MaterialDefault); currentClothingMaterial.name += " (copy)"; GetComponent <Renderer>().sharedMaterial = currentClothingMaterial; } else { GetComponent <Renderer>().sharedMaterial = parentScript.MaterialBody; } }
public void startInteraction(CharacterCustomizationScript customer, int ai) { playerGuy = Instantiate(uiCharacter, playerLoc.transform); customerGuy = Instantiate(uiCharacter, customerLoc.transform); AInum = ai; InteractionPanel.SetActive(true); Camera.main.GetComponent <CameraController> ().ChangeMode(CameraMode.Static); customerName = GameMaster.Instance.CustomerManager.GenerateCustomer().FullName(); if (!EmptyItems()) { customerItem = RandomItem(); } customerSub = RandomSubCat(); playerGuy.GetComponent <CharacterCustomizationScript>().SetAppearanceByData(customer.GetCustomizationData()); customerGuy.GetComponent <CharacterCustomizationScript> ().SetAppearanceByData(GameMaster.Instance.CurrentPlayerObject.GetComponent <CharacterCustomizationScript> ().GetCustomizationData()); //runSubInteraction(0); runInteraction(0); }
private void Update() { if (IsGameInitialized) { currentTime = Time.time; if (!SleepMode) { float timeAdvance = (tGameTime + 1) + Time.deltaTime; // (Time.deltaTime added so that if the game is lagging bad, the in game time will adjust) //Increase in-game time by x minutes if 1 second has passed: if (currentTime >= timeAdvance) { float gameTimeSpeed = GameTimeSpeed_DEFAULT; switch (GameModeManager.GameMode_Current) { case GameMode.Office: gameTimeSpeed = GameModeManager.Office.GameTimeSpeed; break; case GameMode.Shop: gameTimeSpeed = GameModeManager.Shop.GameTimeSpeed; break; } AdvanceInGameTime(gameTimeSpeed); if (DayEnd) { #region <Next day & checks> bool readyNextDay = true; switch (GameModeManager.GameMode_Current) { case GameMode.Office: { readyNextDay = GameModeManager.Office.IsDayEndReady(); break; } case GameMode.Shop: { readyNextDay = GameModeManager.Shop.IsDayEndReady(); break; } } if (readyNextDay) { EndDay(); //* } #endregion } tGameTime = currentTime; } } #region <Player play time> //Increase Player's play time by 1 second if 1 second has passed: if (currentTime >= tPlayerPlayTime + 1) { Player.PlayTime += 1; tPlayerPlayTime = currentTime; AchievementManager.CheckAchievementsByType(AchievementType.PlayerPlayTime); #region **DEBUG PLAY TIME** //Debug.Log("Play time (s): " + Player.PlayTime.ToString()); #endregion } #endregion #region <INPUTS> //TEST: Saving during gameplay if (Input.GetKey(KeyCode.RightShift) && Input.GetKeyUp(KeyCode.S)) { SaveGame(SaveSlotDefault); } if (Input.GetKey(KeyCode.RightShift) && Input.GetKeyUp(KeyCode.U)) { UpgradeManager.PurchaseActiveUpgrade(3); } if (Input.GetKey(KeyCode.RightShift) && Input.GetKeyUp(KeyCode.D)) { Debug.Log("*CURRENT OFFICE VALUE: " + CustomizationManager.Office.GetTotalValue()); int x; bool result = CustomizationManager.Office.RepossessItems(1000f, out x); if (result) { Debug.Log("**REPOSSESSION SUCCESS**"); } else { Debug.Log("**GAME OVER**"); } } //TEST: Lock & Unlock cursor / Sleep mode toggle / Build mode toggle if (Input.GetKeyDown(KeyCode.C) && !Input.GetKey(KeyCode.RightShift)) { //if (Cursor.lockState == CursorLockMode.None) // Cursor.lockState = CursorLockMode.Locked; //else // Cursor.lockState = CursorLockMode.None; //SleepMode = !SleepMode; if (BuildMode) { DisableBuildMode(); } else { EnableBuildMode(); } } //TEST: Player customization stuff if (Input.GetKey(KeyCode.RightShift)) { if (Input.GetKeyDown(KeyCode.C)) { CharacterCustomizationScript player = CurrentPlayerObject.GetComponent <CharacterCustomizationScript>(); player.UnsetAllClothing(); player.SetClothing(1); player.SetAccessoriesByPreset(CustomizationManager.Character.AccessoryPresets[0]); player.UpdateBodyColor(CustomizationManager.Character.SkinColors[3]); } if (Input.GetKeyDown(KeyCode.R)) { //CharacterCustomizationScript player = CurrentPlayerObject.GetComponent<CharacterCustomizationScript>(); //player.UnsetClothing(ClothingSlot.Costume); CharacterCustomizationScript player = CurrentPlayerObject.GetComponent <CharacterCustomizationScript>(); player.RandomizeAppearance(); player.GetCustomizationData(); } if (Input.GetKey(KeyCode.E)) { Player.IncreaseExperience(50); } if (Input.GetKey(KeyCode.H)) { GameObject obj = GameObject.Find("Cylinder"); if (obj) { CurrentPlayerObject.GetComponent <CharacterCustomizationScript>().HoldObject(obj, false, false); } } if (Input.GetKey(KeyCode.T)) { if (!SleepMode) { AdvanceInGameTime(5); } } if (Input.GetKey(KeyCode.KeypadPlus)) { Player.Business.IncreaseMoney(100); } if (Input.GetKey(KeyCode.KeypadMinus)) { Player.Business.DecreaseMoney(100); } } #endregion } switch (Cursor.lockState) { case CursorLockMode.Locked: Cursor.visible = false; break; case CursorLockMode.None: Cursor.visible = true; break; } }