private RagdollCustomization InitializeRagdoll(Transform parent)
    {
        Ragdoll component = UnityEngine.Object.Instantiate(Game.instance.ragdollPrefab.gameObject, parent, worldPositionStays: false).GetComponent <Ragdoll>();

        component.Lock();
        RagdollCustomization ragdollCustomization = component.gameObject.AddComponent <RagdollCustomization>();

        return(component.GetComponent <RagdollCustomization>());
    }
Beispiel #2
0
		public void ApplyPreset(RagdollPresetMetadata preset, bool bake = true)
		{
			if (customization == null)
			{
				customization = human.ragdoll.gameObject.AddComponent<RagdollCustomization>();
			}
			customization.ApplyPreset(preset, forceRebuild: true);
			customization.RebindColors(bake, compress: true);
			customization.ClearOutCachedClipVolumes();
		}
Beispiel #3
0
    public void Initialize(RagdollCustomization customization)
    {
        this.customization = customization;
        unprojectMaterial  = new Material(Shaders.instance.paintShader);
        unprojectCamera    = CustomizationController.instance.mainCamera;
        GameObject gameObject = new GameObject();

        gameObject.transform.SetParent(base.transform, worldPositionStays: false);
        myCam               = gameObject.AddComponent <Camera>();
        myCam.enabled       = false;
        myCam.clearFlags    = CameraClearFlags.Nothing;
        myCam.cullingMask   = int.MinValue;
        myCam.renderingPath = RenderingPath.Forward;
        mask = new Dictionary <WorkshopItemType, int>
        {
            {
                WorkshopItemType.ModelFull,
                7
            },
            {
                WorkshopItemType.ModelHead,
                7
            },
            {
                WorkshopItemType.ModelUpperBody,
                7
            },
            {
                WorkshopItemType.ModelLowerBody,
                7
            }
        };
        parts.Clear();
        if (customization.main != null && customization.main.texture.paintingEnabled)
        {
            parts.Add(customization.main);
        }
        if (customization.head != null && customization.head.texture.paintingEnabled)
        {
            parts.Add(customization.head);
        }
        if (customization.upper != null && customization.upper.texture.paintingEnabled)
        {
            parts.Add(customization.upper);
        }
        if (customization.lower != null && customization.lower.texture.paintingEnabled)
        {
            parts.Add(customization.lower);
        }
        for (int i = 0; i < parts.Count; i++)
        {
            parts[i].texture.EnterPaint();
        }
        StartCoroutine(EnsurePaddedMeshes());
    }
    public override void OnGotFocus()
    {
        base.OnGotFocus();
        CustomizationController.instance.cameraController.FocusCharacterFrontal();
        RagdollCustomization activeCustomization = CustomizationController.instance.activeCustomization;

        modelButton.gameObject.SetActive(WorkshopRepository.instance.GetPartRepository(WorkshopItemType.ModelFull).Count > 1);
        headButton.gameObject.SetActive(activeCustomization.allowHead && WorkshopRepository.instance.GetPartRepository(WorkshopItemType.ModelHead).Count > 1);
        upperBodyButton.gameObject.SetActive(activeCustomization.allowUpper && WorkshopRepository.instance.GetPartRepository(WorkshopItemType.ModelUpperBody).Count > 1);
        lowerBodyButton.gameObject.SetActive(activeCustomization.allowLower && WorkshopRepository.instance.GetPartRepository(WorkshopItemType.ModelLowerBody).Count > 1);
    }
 public void Initialize()
 {
     MenuCameraEffects.EnterCustomization();
     NetGame.instance.StopLocalGame();
     Listener.instance.OverrideTransform(cameraController.cameraHolder);
     customizations[0] = InitializeRagdoll(mainCharacter);
     customizations[1] = InitializeRagdoll(coopCharacter);
     ReloadSkin(0);
     ReloadSkin(1);
     activePlayer        = PlayerPrefs.GetInt("MainSkinIndex", 0);
     activeCustomization = customizations[activePlayer];
     turntable.rotation  = Quaternion.Euler(0f, (activePlayer > 0) ? 180 : 0, 0f);
 }
Beispiel #6
0
 private void ApplyPreset(RagdollPresetMetadata preset, bool bake = true)
 {
     if (customization == null)
     {
         customization = ragdoll.gameObject.AddComponent <RagdollCustomization>();
     }
     customization.ApplyPreset(preset, forceRebuild: true);
     customization.RebindColors(bake, compress: true);
     RigClipVolume[] componentsInChildren = GetComponentsInChildren <RigClipVolume>();
     if (customization.main != null)
     {
         RagdollModelSkinnedMesh[] componentsInChildren2 = customization.main.GetComponentsInChildren <RagdollModelSkinnedMesh>();
         for (int i = 0; i < componentsInChildren2.Length; i++)
         {
             componentsInChildren2[i].Clip(componentsInChildren);
         }
     }
 }
    public void SetActivePlayer(int index)
    {
        PlayerPrefs.SetInt("MainSkinIndex", index);
        activePlayer = index;
        Vector3 eulerAngles = turntable.rotation.eulerAngles;

        angleFrom = eulerAngles.y;
        angleTo   = ((index > 0) ? 180 : 0);
        if (angleFrom > angleTo)
        {
            angleFrom -= 360f;
        }
        transitionPhase = 0f;
        if (!showBoth)
        {
            ShowActive();
        }
        activeCustomization = customizations[index];
    }
Beispiel #8
0
    public override void OnGotFocus()
    {
        base.OnGotFocus();
        CustomizationController.instance.cameraController.navigationEnabled = false;
        isActive = true;
        if (dontReload)
        {
            dontReload = false;
            return;
        }
        RagdollCustomization activeCustomization = CustomizationController.instance.activeCustomization;

        cameraController = CustomizationController.instance.cameraController;
        paint            = GetComponent <PaintTool>();
        paint.Initialize(activeCustomization);
        cursor.Initialize();
        picker.Initialize();
        cursor.color         = (paint.color = (colorPalette.color = color));
        cursor.cursorKernel  = (paint.cursorKernel = cursorKernel);
        cursor.cursorFalloff = (paint.cursorFalloff = cursorFalloff);
        maskVisible          = false;
        maskPanel.gameObject.SetActive(maskVisible);
        ShowMask(show: true);
    }