Skip to content

Commit 227caad

Browse files
author
Yannick
committed
Few fixes for the 0.4 release. More exposed parameters in config.ini. Few fixes for VR about books and scrolls. Changed the InputManager to use Button_1/4 for actions
1 parent 98b7cdf commit 227caad

File tree

16 files changed

+159
-66
lines changed

16 files changed

+159
-66
lines changed

.gitignore

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@ Thumbs.db.meta
66
.vs
77
.vscode
88

9-
# Build files
9+
# Android Build files
1010
*.apk
1111
*.obb
1212

13-
# Lightmaps
14-
*.exr
15-
*.exr.meta
16-
LightmapSnapshot.asset
17-
LightmapSnapshot.asset.meta
18-
LightingData.asset
19-
LightingData.asset.meta
20-
2113
# Visual Studio files
2214
*.cachefile
2315
*.csproj
@@ -29,8 +21,7 @@ LightingData.asset.meta
2921
*.userprefs
3022
*.v11
3123
*.v12
32-
33-
# Misc
24+
*.VC.db
3425
[C|c]onfig.ini
3526

3627
# Folder to exclude
@@ -42,9 +33,4 @@ ipch/
4233
Library/
4334
obj/
4435
Temp/
45-
UWP/
46-
WindowsStore/
47-
WS/
48-
UnityVS/
49-
UnityVS.meta
5036
Data Files/

Assets/Materials/Underwater_Reversed.mat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Material:
88
m_PrefabInternal: {fileID: 0}
99
m_Name: Underwater_Reversed
1010
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
11-
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION
11+
m_ShaderKeywords: _EMISSION
1212
m_LightmapFlags: 1
13-
m_CustomRenderQueue: 3000
13+
m_CustomRenderQueue: -1
1414
stringTagMap:
1515
RenderType: Transparent
1616
m_SavedProperties:
@@ -82,7 +82,7 @@ Material:
8282
second: 1
8383
- first:
8484
name: _DstBlend
85-
second: 10
85+
second: 0
8686
- first:
8787
name: _GlossMapScale
8888
second: 1
@@ -118,7 +118,7 @@ Material:
118118
second: 0
119119
- first:
120120
name: _ZWrite
121-
second: 0
121+
second: 1
122122
m_Colors:
123123
- first:
124124
name: _Color

Assets/Prefabs/TESUnity.prefab

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ MonoBehaviour:
4444
dataPath:
4545
useKinematicRigidbodies: 1
4646
playMusic: 1
47+
materialType: 2
48+
renderPath: 1
4749
ambientIntensity: 1.5
4850
renderSunShadows: 0
4951
renderLightShadows: 0
50-
materialType: 2
51-
renderPath: 1
5252
renderExteriorCellLights: 0
5353
animateLights: 0
5454
antiAliasing: 0
5555
ambientOcclusion: 0
5656
bloom: 0
57+
waterBackSideTransparent: 0
5758
followHeadDirection: 0
5859
UIBackgroundImg: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
5960
UICheckmarkImg: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
@@ -78,6 +79,7 @@ MonoBehaviour:
7879
m_Script: {fileID: 11500000, guid: 18f65c96457599848b0d63ff346899ad, type: 3}
7980
m_Name:
8081
m_EditorClassIdentifier:
82+
bypassConfigINI: 0
8183
--- !u!1001 &100100000
8284
Prefab:
8385
m_ObjectHideFlags: 1

Assets/Scenes/Scene.unity.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Scripts/TES/Components/PathSelectionComponent.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ public class PathSelectionComponent : MonoBehaviour
2121
private Toggle toggle;
2222
private Text errorText;
2323

24+
#if UNITY_EDITOR
25+
[SerializeField]
26+
private bool bypassConfigINI = false;
27+
#endif
28+
2429
private void Start()
2530
{
31+
#if UNITY_EDITOR
32+
if (!bypassConfigINI)
33+
CheckConfigINI();
34+
#else
2635
CheckConfigINI();
27-
36+
#endif
2837
var savedPath = PlayerPrefs.GetString(SavePathKey, string.Empty);
2938
if (savedPath != string.Empty)
3039
defaultMWDataPath = savedPath;
@@ -57,12 +66,21 @@ private void Start()
5766
errorText.gameObject.AddComponent<Outline>();
5867
errorText.enabled = false;
5968

69+
// Load the game if the Data Files folder is here
6070
var path = Path.Combine(System.Environment.CurrentDirectory, "Data Files");
6171
if (Directory.Exists(path))
6272
{
6373
LoadWorld(path);
6474
return;
6575
}
76+
77+
// Or if it's already in the config.ini file.
78+
var tes = GetComponent<TESUnity>();
79+
if (Directory.Exists(tes.dataPath))
80+
{
81+
LoadWorld(tes.dataPath);
82+
return;
83+
}
6684
}
6785

6886
private void OnDestroy()
@@ -139,11 +157,13 @@ private void CheckConfigINI()
139157
case "AmbientOcclusion": tes.ambientOcclusion = ParseBool(value, tes.ambientOcclusion); break;
140158
case "AnimateLights": tes.animateLights = ParseBool(value, tes.animateLights); break;
141159
case "Bloom": tes.bloom = ParseBool(value, tes.bloom); break;
160+
case "MorrowindPath": tes.dataPath = value; break;
142161
case "FollowHeadDirection": tes.followHeadDirection = ParseBool(value, tes.followHeadDirection); break;
143162
case "SunShadows": tes.renderSunShadows = ParseBool(value, tes.renderSunShadows); break;
144163
case "LightShadows": tes.renderLightShadows = ParseBool(value, tes.renderLightShadows); break;
145164
case "PlayMusic": tes.playMusic = ParseBool(value, tes.playMusic); break;
146165
case "RenderExteriorCellLights": tes.renderExteriorCellLights = ParseBool(value, tes.renderExteriorCellLights); break;
166+
case "WaterBackSideTransparent": tes.waterBackSideTransparent = ParseBool(value, tes.waterBackSideTransparent); break;
147167
case "RenderPath":
148168
var renderPathID = ParseInt(value, 0);
149169
if (renderPathID == 1 || renderPathID == 3)

Assets/Scripts/TES/Components/PlayerComponent.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private void Update()
9090
isFlying = !isFlying;
9191
}
9292

93-
if (isGrounded && !isFlying && Input.GetButtonDown("Jump"))
93+
if (isGrounded && !isFlying && Input.GetButtonDown("Button_4"))
9494
{
9595
var newVelocity = rigidbody.velocity;
9696
newVelocity.y = 5;
@@ -207,8 +207,13 @@ private Vector3 CalculateLocalMovementDirection()
207207
// A small hack for French Keyboard...
208208
if (Application.systemLanguage == SystemLanguage.French)
209209
{
210-
direction = Vector3.zero;
210+
// Cancel Qwerty
211+
if (Input.GetKeyDown(KeyCode.W))
212+
direction.z = 0;
213+
else if (Input.GetKeyDown(KeyCode.A))
214+
direction.x = 0;
211215

216+
// Use Azerty
212217
if (Input.GetKey(KeyCode.Z))
213218
direction.z = 1;
214219
else if (Input.GetKey(KeyCode.S))

Assets/Scripts/TES/Components/Records/BookComponent.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace TESUnity.Components.Records
77
public class BookComponent : GenericObjectComponent
88
{
99
private static PlayerComponent _player = null;
10-
private GameObject _container = null;
1110
private static UIBook _uiBook = null;
1211
private static UIScroll _uiScroll = null;
1312

@@ -42,25 +41,8 @@ void Start()
4241
objData.value = BOOK.BKDT.value.ToString();
4342
}
4443

45-
void Update()
46-
{
47-
if (Input.GetButtonDown("Fire1") && _container != null)
48-
{
49-
Destroy(_container);
50-
Player.Pause(false);
51-
return;
52-
}
53-
}
54-
5544
public override void Interact()
5645
{
57-
if (_container != null)
58-
{
59-
Destroy(_container);
60-
Player.Pause(false);
61-
return;
62-
}
63-
6446
var BOOK = (BOOKRecord)record;
6547

6648
if (BOOK.BKDT.scroll == 1)

Assets/Scripts/TES/Components/Records/WeaponComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void Update()
3232
{
3333
if (_isEquiped)
3434
{
35-
if (Input.GetButtonDown("Fire1"))
35+
if (Input.GetButtonDown("Button_1"))
3636
{
3737
if (_isVisible)
3838
PlayAttackAnimation();

Assets/Scripts/TES/MorrowindEngine.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,19 @@ public MorrowindEngine( MorrowindDataReader dataReader )
100100

101101
waterObj = GameObject.Instantiate(TESUnity.instance.waterPrefab);
102102
waterObj.SetActive(false);
103+
104+
if (!TESUnity.instance.waterBackSideTransparent)
105+
{
106+
var side = waterObj.transform.GetChild(0);
107+
var sideMaterial = side.GetComponent<Renderer>().sharedMaterial;
108+
sideMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
109+
sideMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
110+
sideMaterial.SetInt("_ZWrite", 1);
111+
sideMaterial.DisableKeyword("_ALPHATEST_ON");
112+
sideMaterial.DisableKeyword("_ALPHABLEND_ON");
113+
sideMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
114+
sideMaterial.renderQueue = -1;
115+
}
103116
}
104117

105118
public Vector2i GetExteriorCellIndices(Vector3 point)
@@ -227,7 +240,7 @@ public void CastInteractRay()
227240

228241
ShowInteractiveText(component);
229242

230-
if (Input.GetButtonDown("Use"))
243+
if (Input.GetButtonDown("Button_1"))
231244
{
232245
if (component is DoorComponent)
233246
OpenDoor((DoorComponent)component);

Assets/Scripts/TES/TESUnity.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ public enum MWMaterialType
1414

1515
#region Inspector-set Members
1616

17+
[Header("Global")]
1718
public string dataPath;
1819
public bool useKinematicRigidbodies = true;
1920
public bool playMusic = true;
21+
22+
[Header("Rendering")]
23+
public MWMaterialType materialType = MWMaterialType.BumpedDiffuse;
24+
public RenderingPath renderPath = RenderingPath.Forward;
25+
26+
[Header("Lighting")]
2027
public float ambientIntensity = 1.5f;
2128
public bool renderSunShadows = false;
2229
public bool renderLightShadows = false;
23-
public MWMaterialType materialType = MWMaterialType.BumpedDiffuse;
24-
public RenderingPath renderPath = RenderingPath.Forward;
2530
public bool renderExteriorCellLights = false;
2631
public bool animateLights = false;
2732

2833
[Header("Effects")]
29-
public bool antiAliasing;
30-
public bool ambientOcclusion;
31-
public bool bloom;
34+
public bool antiAliasing = false;
35+
public bool ambientOcclusion = false;
36+
public bool bloom = false;
37+
public bool waterBackSideTransparent = false;
3238

3339
[Header("VR")]
3440
public bool followHeadDirection = false;
@@ -42,6 +48,7 @@ public enum MWMaterialType
4248
public Sprite UIMaskImg;
4349
public Sprite UISpriteImg;
4450

51+
[Header("Prefabs")]
4552
public GameObject waterPrefab;
4653

4754
[Header("Debug")]

0 commit comments

Comments
 (0)