private void Start() { _player = gameObject; _body = _player.transform.Find("Body").gameObject; _playerBody = _body.GetComponent <CharacterCustomization>(); _playerHair = _player.GetComponent <HairCustomization>(); if (!_playerBody.IsCreatingCharacter && !_playerHair.IsCreatingCharacter) { LoadHairStyle(); LoadSkinValues(); } }
public void SaveData(GameObject avatarCustomizer) { if (avatarCustomizer) { HairCustomization hairCustomization = avatarCustomizer.GetComponentInChildren <HairCustomization> (); hairBackOutline = hairCustomization.GetBackHairOutline(); hairBackPaint = hairCustomization.GetBackHairPaint(); hairFrontOutline = hairCustomization.GetFrontHairOutline(); hairFrontPaint = hairCustomization.GetFrontHairPaint(); hairColor = hairCustomization.GetHairColor(); // Get eye data EyeCustomization eyeCustomization = avatarCustomizer.GetComponentInChildren <EyeCustomization>(); eyeSprite = eyeCustomization.GetEyeSprite(); // Get skin data SkinCustomization skinCustomization = avatarCustomizer.GetComponentInChildren <SkinCustomization>(); skinColor = skinCustomization.GetSkinColor(); // Get top data TopCustomization topCustomization = avatarCustomizer.GetComponentInChildren <TopCustomization>(); topOutline = topCustomization.GetTopOutline(); topPaint = topCustomization.GetTopPaint(); topColor = topCustomization.GetTopColor(); // Get bottom data BottomsCustomization bottomsCustomization = avatarCustomizer.GetComponentInChildren <BottomsCustomization>(); bottomsOutline = bottomsCustomization.GetBottomsOutline(); bottomsPaint = bottomsCustomization.GetBottomsPaint(); bottomsColor = bottomsCustomization.GetBottomsColor(); // Get shoe data ShoeCustomization shoeCustomization = avatarCustomizer.GetComponentInChildren <ShoeCustomization>(); shoeOutline = shoeCustomization.GetShoeOutline(); shoePaint = shoeCustomization.GetShoePaint(); shoeColor = shoeCustomization.GetShoeColor(); } }