Beispiel #1
0
    private void UpdateActorValues()
    {
        Preset current = new Preset
        {
            gravity  = actor.GetEnableGravity(),
            solid    = actor.GetIsSolid(),
            pushable = actor.GetEnablePhysics(),
            upright  = actor.GetKeepUpright(),
            concave  = actor.GetUseConcaveCollider()
        };

        physicsTabUI.gravityToggle.isOn      = current.gravity;
        physicsTabUI.solidToggle.isOn        = current.solid;
        physicsTabUI.pushableToggle.isOn     = current.pushable;
        physicsTabUI.staysUprightToggle.isOn = current.upright;
        physicsTabUI.concaveToggle.isOn      = current.concave;
        physicsTabUI.concaveToggle.gameObject.SetActive(current.solid && !current.pushable);

        physicsTabUI.gravityToggle.gameObject.SetActive(current.pushable);
        physicsTabUI.staysUprightToggle.gameObject.SetActive(current.pushable);
        physicsTabUI.slidersSection.gameObject.SetActive(current.pushable);

        physicsTabUI.rotationLockToggle.isOn  = actor.GetFreezeRotations();
        physicsTabUI.positionXLockToggle.isOn = actor.GetFreezeX();
        physicsTabUI.positionYLockToggle.isOn = actor.GetFreezeY();
        physicsTabUI.positionZLockToggle.isOn = actor.GetFreezeZ();

        physicsTabUI.ghostPresetToggle.isOn     = BothSolidAndPushable(current, ghostPreset);
        physicsTabUI.solidPresetToggle.isOn     = BothSolidAndPushable(current, solidPreset);
        physicsTabUI.objectPresetToggle.isOn    = PresetsMatch(current, objectPreset);
        physicsTabUI.characterPresetToggle.isOn = PresetsMatch(current, characterPreset);

        if (AllPresetsOff())
        {
            physicsTabUI.presetDescription.text = "";
        }

        TrySettingSliderWithText(actor.GetMass(), physicsTabUI.massSlider, physicsTabUI.massTextInput);
        TrySettingSliderWithText(actor.GetDrag(), physicsTabUI.massDragSlider, physicsTabUI.massDragTextInput);
        TrySettingSliderWithText(actor.GetAngularDrag(), physicsTabUI.angularDragSlider, physicsTabUI.angularDragTextInput);
        TrySettingSliderWithText(actor.GetBounciness(), physicsTabUI.bounceSlider, physicsTabUI.bounceTextInput);
    }