Beispiel #1
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
        }
    }
Beispiel #2
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
        }
    }
Beispiel #3
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
        }
    }
 public ChangeGameStateAction(GameState newGameState, GameStateSO gameStateSO, Moment whenToRun)
 {
     _newGameState = newGameState;
     _gameStateSO  = gameStateSO;
     _whenToRun    = whenToRun;
 }