lonestar

0x10c-inspired space game based on the DCPU-16
git clone git://squid-tech.com/lonestar.git
Log | Files | Refs | README

commit 6a154166664e41dbedd91e33139542db6b2dce07
parent 022fd5eebc4a8c7730da6028e61dd3aab25cc827
Author: Josh Moore <jxm5210@rit.edu>
Date:   Mon, 18 Nov 2019 21:26:53 -0500

Render wires for hardware connections, fix LightDevice bug

Diffstat:
Asrc/LoneStar/Assets/Devices.meta | 8++++++++
Asrc/LoneStar/Assets/Devices/LightDevice.meta | 8++++++++
Rsrc/LoneStar/Assets/Materials/LampMaterials/BulbMaterial.mat -> src/LoneStar/Assets/Devices/LightDevice/BulbMaterial.mat | 0
Rsrc/LoneStar/Assets/Materials/LampMaterials/BulbMaterial.mat.meta -> src/LoneStar/Assets/Devices/LightDevice/BulbMaterial.mat.meta | 0
Asrc/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Rsrc/LoneStar/Assets/Materials/LampMaterials/DeviceScript.cs.meta -> src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs.meta | 0
Asrc/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab | 341+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab.meta | 7+++++++
Rsrc/LoneStar/Assets/Materials/LampMaterials/StandMaterial.mat -> src/LoneStar/Assets/Devices/LightDevice/StandMaterial.mat | 0
Rsrc/LoneStar/Assets/Materials/LampMaterials/StandMaterial.mat.meta -> src/LoneStar/Assets/Devices/LightDevice/StandMaterial.mat.meta | 0
Dsrc/LoneStar/Assets/Materials/LampMaterials.meta | 8--------
Dsrc/LoneStar/Assets/Materials/LampMaterials/DeviceScript.cs | 49-------------------------------------------------
Msrc/LoneStar/Assets/Scenes/SampleScene.unity | 415+++++++++++++++----------------------------------------------------------------
Msrc/LoneStar/Assets/Scripts/DCPU16Controller.cs | 36+++++++++++++++++++++++++++++++++---
14 files changed, 521 insertions(+), 400 deletions(-)

diff --git a/src/LoneStar/Assets/Devices.meta b/src/LoneStar/Assets/Devices.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d6800a792877ca44a9a90c46ef0c24f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/LoneStar/Assets/Devices/LightDevice.meta b/src/LoneStar/Assets/Devices/LightDevice.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 23cf4e27b31119e458ebd5e4fce60f95 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/LoneStar/Assets/Materials/LampMaterials/BulbMaterial.mat b/src/LoneStar/Assets/Devices/LightDevice/BulbMaterial.mat diff --git a/src/LoneStar/Assets/Materials/LampMaterials/BulbMaterial.mat.meta b/src/LoneStar/Assets/Devices/LightDevice/BulbMaterial.mat.meta diff --git a/src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs b/src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs @@ -0,0 +1,49 @@ +´╗┐using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Mirror; + +// LIGHT SPECS +// A = 0 light off +// A = 1 light on + +public class DeviceScript : NetworkBehaviour +{ + // the ID of the company that manufactures this device + const uint MANUFACTURER_ID = 0xDEADBEEF; + // the device ID of this device + const uint DEVICE_ID = 0xAAAABBBB; + // hardware version + const ushort DEVICE_VERSION = 0x0001; + + // handle a hardware interrupt + // GP_REG corresponds to the general-purpose DCPU registers + public void HWI(GameObject dcpu, ushort[] GP_REG) + { + this.gameObject.transform.Find("PointLight").GetComponent<Light>().enabled = GP_REG[0] == 1 ? true : false; + } + + // respond to request for hardware information + public void HWQ(GameObject dcpu, ushort[] GP_REG) + { + ushort[] info = new ushort[8]; + + // hardware ID (registers A+(B<<16)) + info[0] = (ushort)(DEVICE_ID & 0xFFFF); + info[1] = (ushort)((DEVICE_ID >> 16) & 0xFFFF); + + // device version (register C) + info[2] = DEVICE_VERSION; + + // manufacturer ID (registers X+(Y<<16)) + info[3] = (ushort)(MANUFACTURER_ID & 0xFFFF); + info[4] = (ushort)((MANUFACTURER_ID >> 16) & 0xFFFF); + + info[5] = GP_REG[5]; + info[6] = GP_REG[6]; + info[7] = GP_REG[7]; + + // return the information to the requesting DCPU + dcpu.GetComponent<DCPU16Controller>().returnHW(info); + } +} diff --git a/src/LoneStar/Assets/Materials/LampMaterials/DeviceScript.cs.meta b/src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs.meta diff --git a/src/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab b/src/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab @@ -0,0 +1,341 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &7157367172244747160 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7157367172244747167} + - component: {fileID: 7157367172244747165} + - component: {fileID: 6064729815770853023} + m_Layer: 0 + m_Name: LightDevice + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7157367172244747167 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172244747160} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.94, y: 0.835, z: -3.638} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 7157367173681362739} + - {fileID: 7157367172630647511} + - {fileID: 7157367173229024533} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7157367172244747165 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172244747160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3} + m_Name: + m_EditorClassIdentifier: + serverOnly: 0 + m_AssetId: + m_SceneId: 0 +--- !u!114 &6064729815770853023 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172244747160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cfffeb104851e534a86226facc3354a7, type: 3} + m_Name: + m_EditorClassIdentifier: + syncMode: 0 + syncInterval: 0.1 +--- !u!1 &7157367172630647504 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7157367172630647511} + - component: {fileID: 7157367172630647508} + - component: {fileID: 7157367172630647509} + - component: {fileID: 7157367172630647510} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7157367172630647511 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172630647504} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.0000000074506, y: -0.3549999, z: 0} + m_LocalScale: {x: 0.25, y: 1, z: 0.25} + m_Children: [] + m_Father: {fileID: 7157367172244747167} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7157367172630647508 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172630647504} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &7157367172630647509 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172630647504} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: beded0201ff4f0c41a3a76bc2e3fe657, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!65 &7157367172630647510 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367172630647504} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &7157367173229024534 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7157367173229024533} + - component: {fileID: 7157367173229024532} + m_Layer: 0 + m_Name: PointLight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7157367173229024533 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173229024534} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.001, y: 0.27800006, z: -0.002} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7157367172244747167} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!108 &7157367173229024532 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173229024534} + m_Enabled: 0 + serializedVersion: 9 + m_Type: 2 + m_Color: {r: 1, g: 0, b: 0.8144698, a: 1} + m_Intensity: 1 + m_Range: 20 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!1 &7157367173681362732 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7157367173681362739} + - component: {fileID: 7157367173681362736} + - component: {fileID: 7157367173681362737} + - component: {fileID: 7157367173681362738} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7157367173681362739 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173681362732} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.003, y: 0.259, z: 0.004} + m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} + m_Children: [] + m_Father: {fileID: 7157367172244747167} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &7157367173681362736 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173681362732} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &7157367173681362737 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173681362732} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 92343875b42aa5c428903ce4ccf89ad9, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + 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!135 &7157367173681362738 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7157367173681362732} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} diff --git a/src/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab.meta b/src/LoneStar/Assets/Devices/LightDevice/LightDevice.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6a3ee7b8517f9294885e92176b21e219 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/LoneStar/Assets/Materials/LampMaterials/StandMaterial.mat b/src/LoneStar/Assets/Devices/LightDevice/StandMaterial.mat diff --git a/src/LoneStar/Assets/Materials/LampMaterials/StandMaterial.mat.meta b/src/LoneStar/Assets/Devices/LightDevice/StandMaterial.mat.meta diff --git a/src/LoneStar/Assets/Materials/LampMaterials.meta b/src/LoneStar/Assets/Materials/LampMaterials.meta @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 387bed28409498347b78e6c8d01fe87b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/LoneStar/Assets/Materials/LampMaterials/DeviceScript.cs b/src/LoneStar/Assets/Materials/LampMaterials/DeviceScript.cs @@ -1,49 +0,0 @@ -´╗┐using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Mirror; - -// LIGHT SPECS -// A = 0 light off -// A = 1 light on - -public class DeviceScript : NetworkBehaviour -{ - // the ID of the company that manufactures this device - const uint MANUFACTURER_ID = 0xDEADBEEF; - // the device ID of this device - const uint DEVICE_ID = 0xAAAABBBB; - // hardware version - const ushort DEVICE_VERSION = 0x0001; - - // handle a hardware interrupt - // GP_REG corresponds to the general-purpose DCPU registers - public void HWI(GameObject dcpu, ushort[] GP_REG) - { - GameObject.Find("PointLight").GetComponent<Light>().enabled = GP_REG[0] == 1 ? true : false; - } - - // respond to request for hardware information - public void HWQ(GameObject dcpu, ushort[] GP_REG) - { - ushort[] info = new ushort[8]; - - // hardware ID (registers A+(B<<16)) - info[0] = (ushort)(DEVICE_ID & 0xFFFF); - info[1] = (ushort)((DEVICE_ID >> 16) & 0xFFFF); - - // device version (register C) - info[2] = DEVICE_VERSION; - - // manufacturer ID (registers X+(Y<<16)) - info[3] = (ushort)(MANUFACTURER_ID & 0xFFFF); - info[4] = (ushort)((MANUFACTURER_ID >> 16) & 0xFFFF); - - info[5] = GP_REG[5]; - info[6] = GP_REG[6]; - info[7] = GP_REG[7]; - - // return the information to the requesting DCPU - dcpu.GetComponent<DCPU16Controller>().returnHW(info); - } -} diff --git a/src/LoneStar/Assets/Scenes/SampleScene.unity b/src/LoneStar/Assets/Scenes/SampleScene.unity @@ -434,100 +434,8 @@ Transform: - {fileID: 47079378} - {fileID: 610458616} m_Father: {fileID: 0} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &471855571 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 471855572} - - component: {fileID: 471855575} - - component: {fileID: 471855574} - - component: {fileID: 471855573} - m_Layer: 0 - m_Name: Cube - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &471855572 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 471855571} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.0000000074506, y: -1.578, z: 0} - m_LocalScale: {x: 0.25, y: 1, z: 0.25} - m_Children: [] - m_Father: {fileID: 589189276} - m_RootOrder: 1 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!65 &471855573 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 471855571} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &471855574 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 471855571} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: beded0201ff4f0c41a3a76bc2e3fe657, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - 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!33 &471855575 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 471855571} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &480843791 GameObject: m_ObjectHideFlags: 0 @@ -713,70 +621,80 @@ Transform: m_Father: {fileID: 804914385} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &589189275 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 589189276} - - component: {fileID: 589189277} - - component: {fileID: 589189278} - m_Layer: 0 - m_Name: LightDevice - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &589189276 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 589189275} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.94, y: 2.0869079, z: -6.02} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1577014320} - - {fileID: 471855572} - - {fileID: 2029352470} - m_Father: {fileID: 0} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &589189277 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 589189275} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cfffeb104851e534a86226facc3354a7, type: 3} - m_Name: - m_EditorClassIdentifier: - syncMode: 0 - syncInterval: 0.1 ---- !u!114 &589189278 -MonoBehaviour: +--- !u!1001 &563760763 +PrefabInstance: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 589189275} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3} - m_Name: - m_EditorClassIdentifier: - serverOnly: 0 - m_AssetId: - m_SceneId: 2075265141 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7157367172244747160, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Name + value: LightDevice + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalPosition.x + value: -3.3786516 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.838 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalPosition.z + value: -4.23157 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747167, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367172244747165, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_SceneId + value: 3072076613 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6a3ee7b8517f9294885e92176b21e219, type: 3} --- !u!1 &610458614 GameObject: m_ObjectHideFlags: 0 @@ -1067,7 +985,7 @@ Transform: - {fileID: 1255924688} - {fileID: 804914385} m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1038438291 MonoBehaviour: @@ -1547,98 +1465,6 @@ Transform: m_Father: {fileID: 223974227} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 90, y: -90, z: 0} ---- !u!1 &1577014319 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1577014320} - - component: {fileID: 1577014323} - - component: {fileID: 1577014322} - - component: {fileID: 1577014321} - m_Layer: 0 - m_Name: Sphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1577014320 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1577014319} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.003, y: -0.964, z: 0.004} - m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} - m_Children: [] - m_Father: {fileID: 589189276} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!135 &1577014321 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1577014319} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &1577014322 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1577014319} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 92343875b42aa5c428903ce4ccf89ad9, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - 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!33 &1577014323 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1577014319} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1611669224 GameObject: m_ObjectHideFlags: 0 @@ -1915,94 +1741,3 @@ Transform: m_Father: {fileID: 804914385} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2029352469 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2029352470} - - component: {fileID: 2029352471} - m_Layer: 0 - m_Name: PointLight - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2029352470 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2029352469} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.001, y: -0.945, z: -0.002} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 589189276} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!108 &2029352471 -Light: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2029352469} - m_Enabled: 0 - serializedVersion: 9 - m_Type: 2 - m_Color: {r: 1, g: 0, b: 0.8144698, a: 1} - m_Intensity: 1 - m_Range: 20 - m_SpotAngle: 30 - m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 - m_Shadows: - m_Type: 0 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_CullingMatrixOverride: - e00: 1 - e01: 0 - e02: 0 - e03: 0 - e10: 0 - e11: 1 - e12: 0 - e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 - e30: 0 - e31: 0 - e32: 0 - e33: 1 - m_UseCullingMatrixOverride: 0 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingLayerMask: 1 - m_Lightmapping: 4 - m_LightShadowCasterMode: 0 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ColorTemperature: 6570 - m_UseColorTemperature: 0 - m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} - m_UseBoundingSphereOverride: 0 - m_ShadowRadius: 0 - m_ShadowAngle: 0 diff --git a/src/LoneStar/Assets/Scripts/DCPU16Controller.cs b/src/LoneStar/Assets/Scripts/DCPU16Controller.cs @@ -87,6 +87,14 @@ public class DCPU16Controller : NetworkBehaviour // initialize power button's color to the power off state transform.Find("PowerButton").gameObject.GetComponent<Renderer>().material.SetColor("_Color", Color.red); + // initialize drawn connection lines + foreach (Transform port in GameObject.Find("Ports").transform) + { + port.gameObject.AddComponent<LineRenderer>(); + port.gameObject.GetComponent<LineRenderer>().SetWidth(0.1f, 0.1f); + port.gameObject.GetComponent<LineRenderer>().material.color = Color.black; + } + reset(); StartCoroutine(processorLoop()); @@ -131,7 +139,7 @@ public class DCPU16Controller : NetworkBehaviour { if (hit.transform.parent.gameObject.name.Equals("Ports")) { - // "plug" the device into the port by + // "plug" the device into the port plugging.transform.parent = hit.transform; plugging = null; } @@ -162,6 +170,22 @@ public class DCPU16Controller : NetworkBehaviour sendKey((byte)c); } } + + // draw connection lines + foreach (Transform port in GameObject.Find("Ports").transform) + { + LineRenderer render = port.gameObject.GetComponent<LineRenderer>(); + if (port.childCount == 1) + { + render.enabled = true; + render.SetPosition(0, port.position); + render.SetPosition(1, port.GetChild(0).transform.position); + } + else + { + render.enabled = false; + } + } } void OnGUI() @@ -283,6 +307,11 @@ public class DCPU16Controller : NetworkBehaviour screenTexture.Apply(); // reset the list of connected devices + for (int i = 0; i < MAX_DEVICES; i++) + { + PLUGGED_DEVICES[i] = null; + } + int devidx = 0; foreach (Transform port in GameObject.Find("Ports").transform) { @@ -298,9 +327,9 @@ public class DCPU16Controller : NetworkBehaviour } } - for (; devidx < MAX_DEVICES; devidx++) + for (int i = 0; i < MAX_DEVICES; i++) { - PLUGGED_DEVICES[devidx] = null; + UnityEngine.Debug.Log(PLUGGED_DEVICES[i]); } } @@ -810,6 +839,7 @@ public class DCPU16Controller : NetworkBehaviour if (hwiidx < MAX_DEVICES && PLUGGED_DEVICES[hwiidx] != null) { PLUGGED_DEVICES[hwiidx].GetComponent<DeviceScript>().HWI(this.gameObject, GP_REG); + UnityEngine.Debug.Log("Interrupt Device: " + PLUGGED_DEVICES[hwiidx]); } break; default: