//================================================================================ // //================================================================================ using UnityEngine; using System.Collections; using KishiTechUnity.KishiTechDebug; //================================================================================ // //================================================================================ namespace ReaderRabbit { //================================================================================ // //================================================================================ [RequireComponent (typeof(PolygonCollider2D))] public class ItemCommon : MonoBehaviour { //================================================================================ // //================================================================================ // Cache transform accessor. [HideInInspector] public new Transform transform; protected bool m_IsEnabled; protected bool m_PreviousIsEnabled; protected bool m_WasUpAsButton; public bool isCollected; //mycode --rafael --> use isso para evitar interagir mais de uma vez com o item. essa variavel é usadaespecificamente em cada item. protected SceneCommon m_ParentScene; //================================================================================ // //================================================================================ public virtual void Awake() { // Caching transform accessor. transform = gameObject.transform; } //================================================================================ // //================================================================================ public virtual void Start() { m_WasUpAsButton = false; UpdateOnce(); isCollected = false; } //================================================================================ // //================================================================================ public void SetParentScene(SceneCommon parentScene) { m_ParentScene = parentScene; } //================================================================================ // //================================================================================ public virtual void OnMouseDown() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.OnMouseDown()..."); m_WasUpAsButton = false; } //================================================================================ // //================================================================================ public virtual void OnMouseUp() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.OnMouseUp()..."); //m_WasUpAsButton = false; } //================================================================================ // //================================================================================ public virtual void OnMouseUpAsButton() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.OnMouseUpAsButton()..."); m_WasUpAsButton = true; } //================================================================================ // //================================================================================ public bool WasUpAsButton() { return m_WasUpAsButton; } //================================================================================ // //================================================================================ public void ClearWasUpAsButton() { m_WasUpAsButton = false; } //================================================================================ // //================================================================================ public bool IsEnabled() { return m_IsEnabled; } //================================================================================ // //================================================================================ public void Enable() { m_PreviousIsEnabled = m_IsEnabled; m_IsEnabled = GetComponent().enabled = true; } //================================================================================ // //================================================================================ public void Disable() { m_PreviousIsEnabled = m_IsEnabled; m_IsEnabled = GetComponent().enabled = false; } //================================================================================ // //================================================================================ public void SetEnable(bool isEnabled) { m_PreviousIsEnabled = isEnabled; // mycode --rafael --> original one --> //m_PreviousIsEnabled = m_IsEnabled; m_IsEnabled = GetComponent().enabled = isEnabled; // mychange --rafael --> comentei a linha ao lado que estava presente no toriginal --> //m_IsEnabled = collider2D.enabled; } //================================================================================ // //================================================================================ public void ToggleEnable() { m_PreviousIsEnabled = m_IsEnabled; GetComponent().enabled = !GetComponent().enabled; m_IsEnabled = !m_IsEnabled; } //================================================================================ // //================================================================================ public void RestorePrevious() { m_IsEnabled = GetComponent().enabled = m_PreviousIsEnabled; } //================================================================================ // //================================================================================ public virtual void UpdateOnce() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.UpdateOnce()..."); } //================================================================================ // //================================================================================ public virtual void UsedInScene() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.UsedInScene()..."); } //================================================================================ // //================================================================================ public virtual void DoAction() { KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling ItemCommon.DoAction()..."); } } // public class ItemCommon : MonoBehaviour } // namespace ReaderRabbit