diff --git a/Assets/Prefabs/Environment/BurningStick.prefab b/Assets/Prefabs/Environment/BurningStick.prefab index f335a4a..7c85699 100644 --- a/Assets/Prefabs/Environment/BurningStick.prefab +++ b/Assets/Prefabs/Environment/BurningStick.prefab @@ -140,6 +140,7 @@ GameObject: - component: {fileID: -5925851218717166877} - component: {fileID: 2081929903982442016} - component: {fileID: 1226804790312226784} + - component: {fileID: 8044237247712289850} m_Layer: 0 m_Name: BurningStick m_TagString: Untagged @@ -226,9 +227,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f70b810850590804092bb2c772ea6012, type: 3} m_Name: m_EditorClassIdentifier: - Quality: {fileID: 11400000, guid: 62d0193d1d08b814d9328f3dd1d117cb, type: 2} IgnitePoint: {fileID: 7948189956267693667} Grabbed: 0 +--- !u!114 &8044237247712289850 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2086008818391599545} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b647d1ea5d6785a4d8e6f6b2208e5f1c, type: 3} + m_Name: + m_EditorClassIdentifier: + Quality: {fileID: 11400000, guid: 62d0193d1d08b814d9328f3dd1d117cb, type: 2} --- !u!1 &2819347287429737535 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Environment/stick.prefab b/Assets/Prefabs/Environment/stick.prefab index 668e60f..a7872ab 100644 --- a/Assets/Prefabs/Environment/stick.prefab +++ b/Assets/Prefabs/Environment/stick.prefab @@ -56,6 +56,7 @@ GameObject: - component: {fileID: 1830340994370403595} - component: {fileID: 3556743581346332214} - component: {fileID: 1732996613952540235} + - component: {fileID: 7014937997629475779} m_Layer: 10 m_Name: stick m_TagString: Untagged @@ -93,7 +94,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f70b810850590804092bb2c772ea6012, type: 3} m_Name: m_EditorClassIdentifier: - Quality: {fileID: 11400000, guid: 273b9cf97d0c80e449f24a33a2d261d1, type: 2} IgnitePoint: {fileID: 8934967594637573488} Grabbed: 0 --- !u!54 &1732996613952540235 @@ -112,6 +112,19 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 0 +--- !u!114 &7014937997629475779 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2086008818391599545} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b647d1ea5d6785a4d8e6f6b2208e5f1c, type: 3} + m_Name: + m_EditorClassIdentifier: + Quality: {fileID: 11400000, guid: 273b9cf97d0c80e449f24a33a2d261d1, type: 2} --- !u!1 &7882310482220326929 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/VR/Stick VR.prefab b/Assets/Prefabs/VR/Stick VR.prefab index dfa0347..026b21b 100644 --- a/Assets/Prefabs/VR/Stick VR.prefab +++ b/Assets/Prefabs/VR/Stick VR.prefab @@ -4902,6 +4902,7 @@ GameObject: - component: {fileID: 2499151591214202486} - component: {fileID: 5807904180460221178} - component: {fileID: 4109150851726414724} + - component: {fileID: 3611004544794653208} m_Layer: 10 m_Name: Stick VR m_TagString: Untagged @@ -5087,7 +5088,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9b525f40179118940b3017cbda89411f, type: 3} m_Name: m_EditorClassIdentifier: - Quality: {fileID: 11400000, guid: 273b9cf97d0c80e449f24a33a2d261d1, type: 2} IgnitedQuality: {fileID: 11400000, guid: 62d0193d1d08b814d9328f3dd1d117cb, type: 2} IgniteDuration: 0.25 Ignited: 0 @@ -5099,6 +5099,19 @@ MonoBehaviour: TorchLight: {fileID: 8748250233633719603} WarnColor: {r: 1, g: 0.6509804, b: 0.44705883, a: 1} TorchFuel: 0 +--- !u!114 &3611004544794653208 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2086008818391599545} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b647d1ea5d6785a4d8e6f6b2208e5f1c, type: 3} + m_Name: + m_EditorClassIdentifier: + Quality: {fileID: 11400000, guid: 273b9cf97d0c80e449f24a33a2d261d1, type: 2} --- !u!1 &2973616090333718160 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Burnable.cs b/Assets/Scripts/Burnable.cs index f2f07d3..f205139 100644 --- a/Assets/Scripts/Burnable.cs +++ b/Assets/Scripts/Burnable.cs @@ -2,6 +2,6 @@ using System.Collections.Generic; using UnityEngine; -[RequireComponent(typeof(Rigidbody))] public class Burnable : MonoBehaviour { + public BurnQuality Quality; } diff --git a/Assets/Scripts/Campfire.cs b/Assets/Scripts/Campfire.cs index b1e2b9e..85304f8 100644 --- a/Assets/Scripts/Campfire.cs +++ b/Assets/Scripts/Campfire.cs @@ -38,7 +38,7 @@ public class Campfire : MonoBehaviour { private float NextRandomVariance = 0; private float LastRandomVarianceChange = 0; - private List LogQueue = new List(); + private List LogQueue = new List(); private float NextLogTime = 0; private Transform Player; @@ -89,7 +89,7 @@ public class Campfire : MonoBehaviour { Fuel = Mathf.Max(0, Fuel); } - private bool BurnLog(Item burnable) { + private bool BurnLog(Burnable burnable) { if (Fuel >= GoodFuelAmount * 2) { return false; } else { @@ -101,7 +101,7 @@ public class Campfire : MonoBehaviour { private void OnCollisionEnter(Collision c) { if (c.collider.attachedRigidbody != null && c.collider.attachedRigidbody) { - Item Burnable = c.collider.attachedRigidbody.GetComponent(); + Burnable Burnable = c.collider.attachedRigidbody.GetComponent(); if (Burnable != null && !LogQueue.Contains(Burnable)) { Flame.AddFuelEffect += Burnable.Quality.FlameEffect; Sfx.ActiveBurn += Burnable.Quality.SoundEffect; @@ -115,7 +115,7 @@ public class Campfire : MonoBehaviour { private void OnCollisionExit(Collision c) { if (c.collider.attachedRigidbody != null && c.collider.attachedRigidbody) { - Item Burnable = c.collider.attachedRigidbody.GetComponent(); + Burnable Burnable = c.collider.attachedRigidbody.GetComponent(); if (Burnable != null) { LogQueue.Remove(Burnable); } diff --git a/Assets/Scripts/Item.cs b/Assets/Scripts/Item.cs index 1f7e7fd..794a219 100644 --- a/Assets/Scripts/Item.cs +++ b/Assets/Scripts/Item.cs @@ -3,13 +3,19 @@ using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(Rigidbody))] +[RequireComponent(typeof(Burnable))] public class Item : MonoBehaviour { - public BurnQuality Quality; public Transform IgnitePoint; + public BurnQuality Quality { + get { + return Burnable.Quality; + } + } [Header("Runtime values")] public bool Grabbed = false; + private Burnable Burnable; private Rigidbody Body; private Transform World; private bool BeingPlaced = false; @@ -18,6 +24,7 @@ public class Item : MonoBehaviour { private Quaternion GrabRotation; private void Awake() { + Burnable = GetComponent(); Body = GetComponent(); World = GameObject.FindGameObjectWithTag("World").transform; } diff --git a/Assets/Scripts/ItemVR.cs b/Assets/Scripts/ItemVR.cs index b081ff1..5e84c90 100644 --- a/Assets/Scripts/ItemVR.cs +++ b/Assets/Scripts/ItemVR.cs @@ -5,8 +5,8 @@ using UnityEngine; /* * A replacement for the Item class in VR contexts. */ +[RequireComponent(typeof(Burnable))] public class ItemVR : MonoBehaviour { - public BurnQuality Quality; public BurnQuality IgnitedQuality; public float IgniteDuration; public bool Ignited = false; @@ -23,11 +23,13 @@ public class ItemVR : MonoBehaviour { [Header("Runtime values")] public float TorchFuel; + private Burnable Burnable; private int BurningSourceCount = 0; private float IgnitionStartTime = -1; private Color NormalColor; private void Start() { + Burnable = GetComponent(); NormalColor = TorchLight.color; TorchObject.SetActive(Ignited); StickObject.SetActive(!Ignited); @@ -54,7 +56,7 @@ public class ItemVR : MonoBehaviour { TorchObject.SetActive(true); FireParticles.Play(); StickObject.SetActive(false); - Quality = IgnitedQuality; + Burnable.Quality = IgnitedQuality; } }