Straightforwardize MeshDB and CursorHandler, prepare for equipment
This commit is contained in:
parent
2b2ae8fc60
commit
cca48d095d
@ -62,6 +62,21 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -600,7 +615,7 @@ GameObject:
|
||||
- component: {fileID: 4099946104317490}
|
||||
- component: {fileID: 114383476058023772}
|
||||
m_Layer: 0
|
||||
m_Name: Inventory
|
||||
m_Name: Inventory Interface
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -743,6 +758,23 @@ GameObject:
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
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
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -1386,7 +1418,7 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 4236387573765288}
|
||||
m_Father: {fileID: 4883048021777868}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4105190110964144
|
||||
Transform:
|
||||
@ -1455,6 +1487,19 @@ Transform:
|
||||
m_Father: {fileID: 4145663281164610}
|
||||
m_RootOrder: 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
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -1990,6 +2035,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4400199165588268}
|
||||
- {fileID: 4141975958961490}
|
||||
- {fileID: 4883048021777868}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -2155,6 +2201,19 @@ Transform:
|
||||
m_Father: {fileID: 4646528272650776}
|
||||
m_RootOrder: 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
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -2313,9 +2372,10 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 4243620059187726}
|
||||
- {fileID: 4126889091672100}
|
||||
- {fileID: 4778775157160844}
|
||||
- {fileID: 4099946104317490}
|
||||
m_Father: {fileID: 4586682446228250}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4885341820297518
|
||||
Transform:
|
||||
@ -2633,6 +2693,38 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 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
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
@ -4114,6 +4206,13 @@ MeshFilter:
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1631579676868556}
|
||||
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
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 1
|
||||
|
2571
Assets/Scenes/FrontendDevMap.unity
Normal file
2571
Assets/Scenes/FrontendDevMap.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Scenes/FrontendDevMap.unity.meta
Normal file
8
Assets/Scenes/FrontendDevMap.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 876c1932a8e5e45c593f4882a7c30e3e
|
||||
timeCreated: 1494169882
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -9,6 +9,7 @@ namespace Cyber.Controls {
|
||||
/// Handles grabbing the cursor when needed and provides info about the mouse.
|
||||
/// </summary>
|
||||
public class CursorHandler : MonoBehaviour {
|
||||
private static CursorHandler Singleton;
|
||||
|
||||
/// <summary>
|
||||
/// The mouse sensitivity on the screen's x-axis.
|
||||
@ -25,6 +26,29 @@ namespace Cyber.Controls {
|
||||
private bool CursorLocked = 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>
|
||||
/// 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
|
||||
@ -32,15 +56,15 @@ namespace Cyber.Controls {
|
||||
/// </summary>
|
||||
/// <param name="locked">If set to <c>true</c>, cursor might bse
|
||||
/// locked.</param>
|
||||
public void RequestLockState(bool locked) {
|
||||
RequestedLockState = locked;
|
||||
public static void RequestLockState(bool locked) {
|
||||
Singleton.RequestedLockState = locked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is the cursor currently locked?
|
||||
/// </summary>
|
||||
public bool Locked() {
|
||||
return Term.IsVisible() || RequestedLockState;
|
||||
public static bool Locked() {
|
||||
return Term.IsVisible() || Singleton.RequestedLockState;
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
|
@ -89,8 +89,6 @@ namespace Cyber.Controls {
|
||||
/// </summary>
|
||||
public Vector2 ItemGridDimensions;
|
||||
|
||||
private CursorHandler CursorHandler;
|
||||
private MeshDB MeshDB;
|
||||
private bool InventoryOpen = false;
|
||||
private float PreviewVisibility = 0f;
|
||||
|
||||
@ -104,9 +102,6 @@ namespace Cyber.Controls {
|
||||
private Color IconMapColor;
|
||||
|
||||
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;
|
||||
ItemGridCells = new List<Transform>(ItemGridSize);
|
||||
ItemGridCellMeshes = new List<MeshFilter>(ItemGridSize);
|
||||
@ -196,7 +191,7 @@ namespace Cyber.Controls {
|
||||
Item Item = Inventory.Drive.Interface.GetItemAt(x, y);
|
||||
Mesh Mesh = null;
|
||||
if (Item != null) {
|
||||
Mesh = MeshDB.Meshes[Item.ModelID];
|
||||
Mesh = MeshDB.GetMesh(Item.ModelID);
|
||||
}
|
||||
ItemGridCellMeshes[i].mesh = Mesh;
|
||||
|
||||
|
@ -25,14 +25,9 @@ namespace Cyber.Controls {
|
||||
/// </summary>
|
||||
public Camera Camera;
|
||||
|
||||
private CursorHandler CursorHandler;
|
||||
private Vector3 Rotation;
|
||||
private GameObject LastLookedAt;
|
||||
|
||||
private void Start() {
|
||||
CursorHandler = GameObject.Find("/Systems/CursorHandler").GetComponent<CursorHandler>();
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (!Term.IsVisible()) {
|
||||
// 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
|
||||
if (CursorHandler.Locked()) {
|
||||
Rotation.y += Input.GetAxis("Mouse X") * CursorHandler.MouseSensitivityX;
|
||||
Rotation.x = Mathf.Clamp(Rotation.x - Input.GetAxis("Mouse Y") * CursorHandler.MouseSensitivityY, -89, 89);
|
||||
Rotation.y += Input.GetAxis("Mouse X") * CursorHandler.GetMouseSensitivityX();
|
||||
Rotation.x = Mathf.Clamp(Rotation.x - Input.GetAxis("Mouse Y") * CursorHandler.GetMouseSensitivityY(), -89, 89);
|
||||
Character.SetRotation(Rotation);
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,22 @@ namespace Cyber.Util {
|
||||
/// used if meshes are needed at runtime.
|
||||
/// </summary>
|
||||
public class MeshDB : MonoBehaviour {
|
||||
private static MeshDB Singleton;
|
||||
|
||||
/// <summary>
|
||||
/// The meshes that can be used at runtime.
|
||||
/// </summary>
|
||||
public Mesh[] Meshes;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Singleton.
|
||||
/// </summary>
|
||||
public MeshDB() {
|
||||
Singleton = this;
|
||||
}
|
||||
|
||||
public static Mesh GetMesh(int index) {
|
||||
return Singleton.Meshes[index];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user