This commit is contained in:
Sofia 2017-05-14 22:16:55 +03:00
commit 43059e57ca
9 changed files with 2751 additions and 27 deletions

View File

@ -62,6 +62,21 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &1067606113877164
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4141975958961490}
m_Layer: 0
m_Name: Equipment Interface
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1073554920665706 --- !u!1 &1073554920665706
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -600,7 +615,7 @@ GameObject:
- component: {fileID: 4099946104317490} - component: {fileID: 4099946104317490}
- component: {fileID: 114383476058023772} - component: {fileID: 114383476058023772}
m_Layer: 0 m_Layer: 0
m_Name: Inventory m_Name: Inventory Interface
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -743,6 +758,23 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &1593278606667730
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4778775157160844}
- component: {fileID: 33975615408091930}
- component: {fileID: 23193880740220832}
m_Layer: 0
m_Name: Hat Mesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1603012649709942 --- !u!1 &1603012649709942
GameObject: GameObject:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -1386,7 +1418,7 @@ Transform:
m_Children: m_Children:
- {fileID: 4236387573765288} - {fileID: 4236387573765288}
m_Father: {fileID: 4883048021777868} m_Father: {fileID: 4883048021777868}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4105190110964144 --- !u!4 &4105190110964144
Transform: Transform:
@ -1455,6 +1487,19 @@ Transform:
m_Father: {fileID: 4145663281164610} m_Father: {fileID: 4145663281164610}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4141975958961490
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1067606113877164}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4586682446228250}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4145297277959534 --- !u!4 &4145297277959534
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -1990,6 +2035,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 4400199165588268} - {fileID: 4400199165588268}
- {fileID: 4141975958961490}
- {fileID: 4883048021777868} - {fileID: 4883048021777868}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
@ -2155,6 +2201,19 @@ Transform:
m_Father: {fileID: 4646528272650776} m_Father: {fileID: 4646528272650776}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4778775157160844
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1593278606667730}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.125, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4883048021777868}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4783870784903044 --- !u!4 &4783870784903044
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -2313,9 +2372,10 @@ Transform:
m_Children: m_Children:
- {fileID: 4243620059187726} - {fileID: 4243620059187726}
- {fileID: 4126889091672100} - {fileID: 4126889091672100}
- {fileID: 4778775157160844}
- {fileID: 4099946104317490} - {fileID: 4099946104317490}
m_Father: {fileID: 4586682446228250} m_Father: {fileID: 4586682446228250}
m_RootOrder: 1 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4885341820297518 --- !u!4 &4885341820297518
Transform: Transform:
@ -2633,6 +2693,38 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!23 &23193880740220832
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1593278606667730}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: cac55f0f5d2b94909899376ddfca7276, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!23 &23202936207886656 --- !u!23 &23202936207886656
MeshRenderer: MeshRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -4114,6 +4206,13 @@ MeshFilter:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1631579676868556} m_GameObject: {fileID: 1631579676868556}
m_Mesh: {fileID: 4300000, guid: 8d9188969010c44ce935ad4421c967df, type: 3} m_Mesh: {fileID: 4300000, guid: 8d9188969010c44ce935ad4421c967df, type: 3}
--- !u!33 &33975615408091930
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1593278606667730}
m_Mesh: {fileID: 0}
--- !u!64 &64013687062017004 --- !u!64 &64013687062017004
MeshCollider: MeshCollider:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 876c1932a8e5e45c593f4882a7c30e3e
timeCreated: 1494169882
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using Cyber.Util;
namespace Cyber.Console { namespace Cyber.Console {

View File

@ -9,6 +9,7 @@ namespace Cyber.Controls {
/// Handles grabbing the cursor when needed and provides info about the mouse. /// Handles grabbing the cursor when needed and provides info about the mouse.
/// </summary> /// </summary>
public class CursorHandler : MonoBehaviour { public class CursorHandler : MonoBehaviour {
private static CursorHandler Singleton;
/// <summary> /// <summary>
/// The mouse sensitivity on the screen's x-axis. /// The mouse sensitivity on the screen's x-axis.
@ -25,6 +26,29 @@ namespace Cyber.Controls {
private bool CursorLocked = true; private bool CursorLocked = true;
private bool RequestedLockState = true; private bool RequestedLockState = true;
/// <summary>
/// Sets the Singleton.
/// </summary>
public CursorHandler() {
Singleton = this;
}
/// <summary>
/// Gets the mouse sentivity on the x-axis.
/// </summary>
/// <returns>The mouse sentivity on the x-axis.</returns>
public static float GetMouseSensitivityX() {
return Singleton.MouseSensitivityX;
}
/// <summary>
/// Gets the mouse sentivity on the y-axis.
/// </summary>
/// <returns>The mouse sentivity on the y-axis.</returns>
public static float GetMouseSensitivityY() {
return Singleton.MouseSensitivityY;
}
/// <summary> /// <summary>
/// Request a new lock state. The cursor will be locked in case there /// Request a new lock state. The cursor will be locked in case there
/// isn't another reason to have it in a different state (like the /// isn't another reason to have it in a different state (like the
@ -32,15 +56,15 @@ namespace Cyber.Controls {
/// </summary> /// </summary>
/// <param name="locked">If set to <c>true</c>, cursor might bse /// <param name="locked">If set to <c>true</c>, cursor might bse
/// locked.</param> /// locked.</param>
public void RequestLockState(bool locked) { public static void RequestLockState(bool locked) {
RequestedLockState = locked; Singleton.RequestedLockState = locked;
} }
/// <summary> /// <summary>
/// Is the cursor currently locked? /// Is the cursor currently locked?
/// </summary> /// </summary>
public bool Locked() { public static bool Locked() {
return Term.IsVisible() || RequestedLockState; return Term.IsVisible() || Singleton.RequestedLockState;
} }
private void Start() { private void Start() {

View File

@ -89,8 +89,6 @@ namespace Cyber.Controls {
/// </summary> /// </summary>
public Vector2 ItemGridDimensions; public Vector2 ItemGridDimensions;
private CursorHandler CursorHandler;
private MeshDB MeshDB;
private bool InventoryOpen = false; private bool InventoryOpen = false;
private float PreviewVisibility = 0f; private float PreviewVisibility = 0f;
@ -104,9 +102,6 @@ namespace Cyber.Controls {
private Color IconMapColor; private Color IconMapColor;
private void Start() { private void Start() {
CursorHandler = GameObject.Find("/Systems/CursorHandler").GetComponent<CursorHandler>();
MeshDB = GameObject.Find("/Systems/MeshDB").GetComponent<MeshDB>();
int ItemGridSize = (int) ItemGridDimensions.x * (int) ItemGridDimensions.y; int ItemGridSize = (int) ItemGridDimensions.x * (int) ItemGridDimensions.y;
ItemGridCells = new List<Transform>(ItemGridSize); ItemGridCells = new List<Transform>(ItemGridSize);
ItemGridCellMeshes = new List<MeshFilter>(ItemGridSize); ItemGridCellMeshes = new List<MeshFilter>(ItemGridSize);
@ -196,7 +191,7 @@ namespace Cyber.Controls {
Item Item = Inventory.Drive.Interface.GetItemAt(x, y); Item Item = Inventory.Drive.Interface.GetItemAt(x, y);
Mesh Mesh = null; Mesh Mesh = null;
if (Item != null) { if (Item != null) {
Mesh = MeshDB.Meshes[Item.ModelID]; Mesh = MeshDB.GetMesh(Item.ModelID);
} }
ItemGridCellMeshes[i].mesh = Mesh; ItemGridCellMeshes[i].mesh = Mesh;

View File

@ -25,14 +25,9 @@ namespace Cyber.Controls {
/// </summary> /// </summary>
public Camera Camera; public Camera Camera;
private CursorHandler CursorHandler;
private Vector3 Rotation; private Vector3 Rotation;
private GameObject LastLookedAt; private GameObject LastLookedAt;
private void Start() {
CursorHandler = GameObject.Find("/Systems/CursorHandler").GetComponent<CursorHandler>();
}
private void Update() { private void Update() {
if (!Term.IsVisible()) { if (!Term.IsVisible()) {
// Don't do any "gameplay stuff" if the debug console is up // Don't do any "gameplay stuff" if the debug console is up
@ -48,8 +43,8 @@ namespace Cyber.Controls {
// Rotation (only when cursor is locked // Rotation (only when cursor is locked
if (CursorHandler.Locked()) { if (CursorHandler.Locked()) {
Rotation.y += Input.GetAxis("Mouse X") * CursorHandler.MouseSensitivityX; Rotation.y += Input.GetAxis("Mouse X") * CursorHandler.GetMouseSensitivityX();
Rotation.x = Mathf.Clamp(Rotation.x - Input.GetAxis("Mouse Y") * CursorHandler.MouseSensitivityY, -89, 89); Rotation.x = Mathf.Clamp(Rotation.x - Input.GetAxis("Mouse Y") * CursorHandler.GetMouseSensitivityY(), -89, 89);
Character.SetRotation(Rotation); Character.SetRotation(Rotation);
} }

View File

@ -2,7 +2,20 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Cyber.Util {
/// <summary>
/// Conjures useful information about fonts.
/// </summary>
public class FontUtil : MonoBehaviour { public class FontUtil : MonoBehaviour {
/// <summary>
/// Gets the width of the character.
/// </summary>
/// <returns>The character width.</returns>
/// <param name="font">Font.</param>
/// <param name="fontSize">Font size.</param>
/// <param name="fontStyle">Font style.</param>
public static float GetCharacterWidth(Font font, int fontSize, FontStyle fontStyle) { public static float GetCharacterWidth(Font font, int fontSize, FontStyle fontStyle) {
CharacterInfo CharInfo; CharacterInfo CharInfo;
font.RequestCharactersInTexture("W", fontSize, fontStyle); font.RequestCharactersInTexture("W", fontSize, fontStyle);
@ -10,3 +23,4 @@ public class FontUtil : MonoBehaviour {
return CharInfo.glyphWidth - 1; return CharInfo.glyphWidth - 1;
} }
} }
}

View File

@ -9,10 +9,27 @@ namespace Cyber.Util {
/// used if meshes are needed at runtime. /// used if meshes are needed at runtime.
/// </summary> /// </summary>
public class MeshDB : MonoBehaviour { public class MeshDB : MonoBehaviour {
private static MeshDB Singleton;
/// <summary> /// <summary>
/// The meshes that can be used at runtime. /// The meshes that can be used at runtime.
/// </summary> /// </summary>
public Mesh[] Meshes; public Mesh[] Meshes;
/// <summary>
/// Sets the Singleton.
/// </summary>
public MeshDB() {
Singleton = this;
}
/// <summary>
/// Get the mesh at the defined index.
/// </summary>
/// <returns>The mesh.</returns>
/// <param name="index">Index.</param>
public static Mesh GetMesh(int index) {
return Singleton.Meshes[index];
}
} }
} }