Example #1
0
    private void Reset()
    {
        if (Application.isEditor)
        {
            if (crossSceneSceneDataSO == null)
            {
#if UNITY_EDITOR
                crossSceneSceneDataSO = AssetManagement.FindAssetByType <CrossSceneSceneDataSO>();

                UnityEditor.EditorUtility.SetDirty(this);
#endif
            }
            if (playerTransformMBDO == null)
            {
                MBDOInitializationHelper mBDOInitializationHelper = default;

                //IMPORTNANT STEP!!!
                mBDOInitializationHelper.SetupCardinalSubSystem(this);
                mBDOInitializationHelper.SetupMBDO(ref playerTransformMBDO);
#if UNITY_EDITOR
                UnityEditor.EditorUtility.SetDirty(this);
#endif
            }
        }
    }
Example #2
0
    private void OnValidate()
    {
        if (Application.isEditor)
        {
            spriteRenderers = GetComponentsInChildren <SpriteRenderer>();
            SpriteRenderer tmp = GetComponent <SpriteRenderer>();
            if (tmp != null)
            {
                spriteRenderers.Append(tmp);
            }

            childTransforms = GetComponentsInChildren <Transform>();

            if (crossSceneSceneDataSO == null)
            {
#if UNITY_EDITOR
                crossSceneSceneDataSO = AssetManagement.FindAssetByType <CrossSceneSceneDataSO>();
#endif
            }

            if (playerTransformMBDO == null)
            {
                MBDOInitializationHelper mBDOInitializationHelper = default;

                //IMPORTNANT STEP!!!
                mBDOInitializationHelper.SetupCardinalSubSystem(this);
                mBDOInitializationHelper.SetupMBDO(ref playerTransformMBDO);
            }
#if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
    }
Example #3
0
#pragma warning restore CS0649

    public void OnValidate()
    {
        if (Application.isEditor)
        {
#if UNITY_EDITOR
            IMovable[]   movables1   = GetComponents <IMovable>();
            IUsesInput[] usesInputs1 = GetComponents <IUsesInput>();
            movables.Clear();
            usesInputs.Clear();
            foreach (IMovable movable in movables1)
            {
                movables.Add((MonoBehaviour)movable);
            }
            foreach (IUsesInput usesInput in usesInputs1)
            {
                usesInputs.Add((MonoBehaviour)usesInput);
            }
            if (gameStateSO == null)
            {
                gameStateSO = AssetManagement.FindAssetByType <GameStateSO>();
            }
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
    }
Example #4
0
#pragma warning restore CS0649 // varriable is never assigned to and will always have it's default value
    public virtual void OnValidate()
    {
        if (Application.isEditor)
        {
            if (musicMessageEventSO == null)
            {
#if UNITY_EDITOR
                musicMessageEventSO = AssetManagement.FindAssetByType <MusicMessageEventSO>();
                UnityEditor.EditorUtility.SetDirty(this);
#endif
            }
        }
    }
Example #5
0
#pragma warning restore CS0649
    private void OnValidate()
    {
        if (Application.isEditor)
        {
#if UNITY_EDITOR
            if (gameStateSO == null)
            {
                gameStateSO = AssetManagement.FindAssetByType <GameStateSO>();
            }
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
    }
Example #6
0
    private void OnValidate()
    {
        if (Application.isEditor)
        {
            if (musicPlayer == null)
            {
#if UNITY_EDITOR
                musicPlayer = GetComponent <MusicPlayer>();
#endif
            }

            if (musicMessageEventSO == null)
            {
#if UNITY_EDITOR
                musicMessageEventSO = AssetManagement.FindAssetByType <MusicMessageEventSO>();
                UnityEditor.EditorUtility.SetDirty(this);
#endif
            }
        }
    }
Example #7
0
#pragma warning restore IDE0044 // Add readonly modifier

    private void OnValidate()
    {
        if (Application.isEditor)
        {
            if (animator == null)
            {
                animator = GetComponent <Animator>();
#if UNITY_EDITOR
                UnityEditor.EditorUtility.SetDirty(this);
#endif
            }
        }

        if (image == null)
        {
            image = GetComponent <Image>();
#if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }

        if (spriteRenderer == null)
        {
            spriteRenderer = GetComponent <SpriteRenderer>();
#if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
        if (gameStateSO == null)
        {
#if UNITY_EDITOR
            gameStateSO = AssetManagement.FindAssetByType <GameStateSO>();
            UnityEditor.EditorUtility.SetDirty(this);
#endif
        }
    }