Skip to content

Commit

Permalink
Few fixes for the 0.4 release. More exposed parameters in config.ini.…
Browse files Browse the repository at this point in the history
… Few fixes for VR about books and scrolls. Changed the InputManager to use Button_1/4 for actions
  • Loading branch information
Yannick committed Oct 18, 2016
1 parent 98b7cdf commit 227caad
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 66 deletions.
18 changes: 2 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ Thumbs.db.meta
.vs
.vscode

# Build files
# Android Build files
*.apk
*.obb

# Lightmaps
*.exr
*.exr.meta
LightmapSnapshot.asset
LightmapSnapshot.asset.meta
LightingData.asset
LightingData.asset.meta

# Visual Studio files
*.cachefile
*.csproj
Expand All @@ -29,8 +21,7 @@ LightingData.asset.meta
*.userprefs
*.v11
*.v12

# Misc
*.VC.db
[C|c]onfig.ini

# Folder to exclude
Expand All @@ -42,9 +33,4 @@ ipch/
Library/
obj/
Temp/
UWP/
WindowsStore/
WS/
UnityVS/
UnityVS.meta
Data Files/
8 changes: 4 additions & 4 deletions Assets/Materials/Underwater_Reversed.mat
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Material:
m_PrefabInternal: {fileID: 0}
m_Name: Underwater_Reversed
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: 3000
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Transparent
m_SavedProperties:
Expand Down Expand Up @@ -82,7 +82,7 @@ Material:
second: 1
- first:
name: _DstBlend
second: 10
second: 0
- first:
name: _GlossMapScale
second: 1
Expand Down Expand Up @@ -118,7 +118,7 @@ Material:
second: 0
- first:
name: _ZWrite
second: 0
second: 1
m_Colors:
- first:
name: _Color
Expand Down
6 changes: 4 additions & 2 deletions Assets/Prefabs/TESUnity.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ MonoBehaviour:
dataPath:
useKinematicRigidbodies: 1
playMusic: 1
materialType: 2
renderPath: 1
ambientIntensity: 1.5
renderSunShadows: 0
renderLightShadows: 0
materialType: 2
renderPath: 1
renderExteriorCellLights: 0
animateLights: 0
antiAliasing: 0
ambientOcclusion: 0
bloom: 0
waterBackSideTransparent: 0
followHeadDirection: 0
UIBackgroundImg: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
UICheckmarkImg: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
Expand All @@ -78,6 +79,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 18f65c96457599848b0d63ff346899ad, type: 3}
m_Name:
m_EditorClassIdentifier:
bypassConfigINI: 0
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/Scene.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion Assets/Scripts/TES/Components/PathSelectionComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ public class PathSelectionComponent : MonoBehaviour
private Toggle toggle;
private Text errorText;

#if UNITY_EDITOR
[SerializeField]
private bool bypassConfigINI = false;
#endif

private void Start()
{
#if UNITY_EDITOR
if (!bypassConfigINI)
CheckConfigINI();
#else
CheckConfigINI();

#endif
var savedPath = PlayerPrefs.GetString(SavePathKey, string.Empty);
if (savedPath != string.Empty)
defaultMWDataPath = savedPath;
Expand Down Expand Up @@ -57,12 +66,21 @@ private void Start()
errorText.gameObject.AddComponent<Outline>();
errorText.enabled = false;

// Load the game if the Data Files folder is here
var path = Path.Combine(System.Environment.CurrentDirectory, "Data Files");
if (Directory.Exists(path))
{
LoadWorld(path);
return;
}

// Or if it's already in the config.ini file.
var tes = GetComponent<TESUnity>();
if (Directory.Exists(tes.dataPath))
{
LoadWorld(tes.dataPath);
return;
}
}

private void OnDestroy()
Expand Down Expand Up @@ -139,11 +157,13 @@ private void CheckConfigINI()
case "AmbientOcclusion": tes.ambientOcclusion = ParseBool(value, tes.ambientOcclusion); break;
case "AnimateLights": tes.animateLights = ParseBool(value, tes.animateLights); break;
case "Bloom": tes.bloom = ParseBool(value, tes.bloom); break;
case "MorrowindPath": tes.dataPath = value; break;
case "FollowHeadDirection": tes.followHeadDirection = ParseBool(value, tes.followHeadDirection); break;
case "SunShadows": tes.renderSunShadows = ParseBool(value, tes.renderSunShadows); break;
case "LightShadows": tes.renderLightShadows = ParseBool(value, tes.renderLightShadows); break;
case "PlayMusic": tes.playMusic = ParseBool(value, tes.playMusic); break;
case "RenderExteriorCellLights": tes.renderExteriorCellLights = ParseBool(value, tes.renderExteriorCellLights); break;
case "WaterBackSideTransparent": tes.waterBackSideTransparent = ParseBool(value, tes.waterBackSideTransparent); break;
case "RenderPath":
var renderPathID = ParseInt(value, 0);
if (renderPathID == 1 || renderPathID == 3)
Expand Down
9 changes: 7 additions & 2 deletions Assets/Scripts/TES/Components/PlayerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void Update()
isFlying = !isFlying;
}

if (isGrounded && !isFlying && Input.GetButtonDown("Jump"))
if (isGrounded && !isFlying && Input.GetButtonDown("Button_4"))
{
var newVelocity = rigidbody.velocity;
newVelocity.y = 5;
Expand Down Expand Up @@ -207,8 +207,13 @@ private Vector3 CalculateLocalMovementDirection()
// A small hack for French Keyboard...
if (Application.systemLanguage == SystemLanguage.French)
{
direction = Vector3.zero;
// Cancel Qwerty
if (Input.GetKeyDown(KeyCode.W))
direction.z = 0;
else if (Input.GetKeyDown(KeyCode.A))
direction.x = 0;

// Use Azerty
if (Input.GetKey(KeyCode.Z))
direction.z = 1;
else if (Input.GetKey(KeyCode.S))
Expand Down
18 changes: 0 additions & 18 deletions Assets/Scripts/TES/Components/Records/BookComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace TESUnity.Components.Records
public class BookComponent : GenericObjectComponent
{
private static PlayerComponent _player = null;
private GameObject _container = null;
private static UIBook _uiBook = null;
private static UIScroll _uiScroll = null;

Expand Down Expand Up @@ -42,25 +41,8 @@ void Start()
objData.value = BOOK.BKDT.value.ToString();
}

void Update()
{
if (Input.GetButtonDown("Fire1") && _container != null)
{
Destroy(_container);
Player.Pause(false);
return;
}
}

public override void Interact()
{
if (_container != null)
{
Destroy(_container);
Player.Pause(false);
return;
}

var BOOK = (BOOKRecord)record;

if (BOOK.BKDT.scroll == 1)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/TES/Components/Records/WeaponComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void Update()
{
if (_isEquiped)
{
if (Input.GetButtonDown("Fire1"))
if (Input.GetButtonDown("Button_1"))
{
if (_isVisible)
PlayAttackAnimation();
Expand Down
15 changes: 14 additions & 1 deletion Assets/Scripts/TES/MorrowindEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ public MorrowindEngine( MorrowindDataReader dataReader )

waterObj = GameObject.Instantiate(TESUnity.instance.waterPrefab);
waterObj.SetActive(false);

if (!TESUnity.instance.waterBackSideTransparent)
{
var side = waterObj.transform.GetChild(0);
var sideMaterial = side.GetComponent<Renderer>().sharedMaterial;
sideMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
sideMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
sideMaterial.SetInt("_ZWrite", 1);
sideMaterial.DisableKeyword("_ALPHATEST_ON");
sideMaterial.DisableKeyword("_ALPHABLEND_ON");
sideMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
sideMaterial.renderQueue = -1;
}
}

public Vector2i GetExteriorCellIndices(Vector3 point)
Expand Down Expand Up @@ -227,7 +240,7 @@ public void CastInteractRay()

ShowInteractiveText(component);

if (Input.GetButtonDown("Use"))
if (Input.GetButtonDown("Button_1"))
{
if (component is DoorComponent)
OpenDoor((DoorComponent)component);
Expand Down
17 changes: 12 additions & 5 deletions Assets/Scripts/TES/TESUnity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,27 @@ public enum MWMaterialType

#region Inspector-set Members

[Header("Global")]
public string dataPath;
public bool useKinematicRigidbodies = true;
public bool playMusic = true;

[Header("Rendering")]
public MWMaterialType materialType = MWMaterialType.BumpedDiffuse;
public RenderingPath renderPath = RenderingPath.Forward;

[Header("Lighting")]
public float ambientIntensity = 1.5f;
public bool renderSunShadows = false;
public bool renderLightShadows = false;
public MWMaterialType materialType = MWMaterialType.BumpedDiffuse;
public RenderingPath renderPath = RenderingPath.Forward;
public bool renderExteriorCellLights = false;
public bool animateLights = false;

[Header("Effects")]
public bool antiAliasing;
public bool ambientOcclusion;
public bool bloom;
public bool antiAliasing = false;
public bool ambientOcclusion = false;
public bool bloom = false;
public bool waterBackSideTransparent = false;

[Header("VR")]
public bool followHeadDirection = false;
Expand All @@ -42,6 +48,7 @@ public enum MWMaterialType
public Sprite UIMaskImg;
public Sprite UISpriteImg;

[Header("Prefabs")]
public GameObject waterPrefab;

[Header("Debug")]
Expand Down
9 changes: 9 additions & 0 deletions Assets/Scripts/TES/UI/UIBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,18 @@ void Start()
_background.sprite = GUIUtils.CreateSprite(texture);
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localScale = Vector3.one;
Close();
}

void Update()
{
if (Input.GetButtonDown("Button_3"))
Take();
else if (Input.GetButton("Button_2"))
Close();
}

public void Show(BOOKRecord book)
{
_bookRecord = book;
Expand Down
9 changes: 9 additions & 0 deletions Assets/Scripts/TES/UI/UIScroll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ void Start()
_background.sprite = GUIUtils.CreateSprite(texture);
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localScale = Vector3.one;
Close();
}

void Update()
{
if (Input.GetButtonDown("Button_3"))
Take();
else if (Input.GetButton("Button_2"))
Close();
}

public void Show(BOOKRecord book)
{
_bookRecord = book;
Expand Down
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#TESUnity Changelog

## Version 0.4 - 10/18/2016
### Added
- New flags to enable new features (see readme.md)
- Experimental static creatures support
- Experimental weapon support (with home made animation)
- Books and scrolls support
- Crosshair
- Morrowind cursor

### Changes
- Use the same keys binding as Morrowind

### Fixes
- Fixed an encoding issue for texts with accents

## Version 0.3 - 10/09/2016
### Added
- More parameters in config.ini
Expand Down
Loading

0 comments on commit 227caad

Please sign in to comment.