lonestar

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

commit 51860e6b58bef5e2c6c662e030e83449aca3ec4d
parent 630ccfc57d70243319b6a5678b095d198ff1dc88
Author: Josh Moore <jxm5210@rit.edu>
Date:   Tue, 19 Nov 2019 01:21:43 -0500

Add some interesting color behavior to the light device

Diffstat:
Msrc/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs | 16+++++++++++++++-
Msrc/LoneStar/Assets/Scenes/SampleScene.unity | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs b/src/LoneStar/Assets/Devices/LightDevice/DeviceScript.cs @@ -16,11 +16,25 @@ public class DeviceScript : NetworkBehaviour // hardware version const ushort DEVICE_VERSION = 0x0001; + void Start() + { + this.gameObject.transform.Find("Sphere").GetComponent<Renderer>().material.color = Color.white; + } + // 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; + if (GP_REG[0] == 1) + { + this.gameObject.transform.Find("PointLight").GetComponent<Light>().enabled = true; + this.gameObject.transform.Find("Sphere").gameObject.GetComponent<Renderer>().material.color = this.gameObject.transform.Find("PointLight").GetComponent<Light>().color; + } + else + { + this.gameObject.transform.Find("PointLight").GetComponent<Light>().enabled = false; + this.gameObject.transform.Find("Sphere").gameObject.GetComponent<Renderer>().material.color = Color.white; + } } // respond to request for hardware information diff --git a/src/LoneStar/Assets/Scenes/SampleScene.unity b/src/LoneStar/Assets/Scenes/SampleScene.unity @@ -285,6 +285,31 @@ PrefabInstance: propertyPath: m_SceneId value: 2181645215 objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.g + value: 0.38176292 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Intensity + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_BounceIntensity + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6a3ee7b8517f9294885e92176b21e219, type: 3} --- !u!1 &181700529 @@ -582,6 +607,26 @@ PrefabInstance: propertyPath: m_SceneId value: 2225361569 objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.r + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.g + value: 0.6279521 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6a3ee7b8517f9294885e92176b21e219, type: 3} --- !u!1 &480843791 @@ -841,6 +886,26 @@ PrefabInstance: propertyPath: m_SceneId value: 3072076613 objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.r + value: 0.20388949 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Color.b + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7157367173229024532, guid: 6a3ee7b8517f9294885e92176b21e219, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 6a3ee7b8517f9294885e92176b21e219, type: 3} --- !u!1 &610458614