Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. //using System;
  2. //using System.Collections;
  3. //using System.Collections.Generic;
  4. //using UnityEngine;
  5. //using UnityEngine.UI;
  6.  
  7. //public class AdventureGame : MonoBehaviour
  8. //{
  9. //    [SerializeField] Text textComponente;
  10. //    [SerializeField] State startingState;
  11.  
  12. //    State state;
  13.  
  14. //
  15. //    void Start()
  16. //    {
  17. //        state = startingState;
  18. //        textComponente.text = state.GetStateStory();
  19.  
  20. //    }
  21.  
  22. //    // Update is called once per frame
  23. //    void Update()
  24. //    {
  25. //        ManageState();
  26. //    }
  27.  
  28. //    private void ManageState()
  29. //    {
  30. //        var nextStates = state.GetNextStates();
  31.  
  32. //        if (Input.GetKeyDown(KeyCode.Alpha1))
  33. //        {
  34. //            state = nextStates[0];
  35. //        }
  36. //        else if (Input.GetKeyDown(KeyCode.Alpha2))
  37. //        {
  38. //            state = nextStates[1];
  39. //        }
  40. //        else if (Input.GetKeyDown(KeyCode.Alpha3))
  41. //        {
  42. //            state = nextStates[2];
  43. //        }
  44. //        textComponente.text = state.GetStateStory();
  45. //    }
  46. //}
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. using System.Collections;
  58. using System.Collections.Generic;
  59. using UnityEngine;
  60.  
  61. [CreateAssetMenu(menuName = "State")]
  62.  
  63. public class State : ScriptableObject
  64. {
  65.     [TextArea(10,14)] [SerializeField] string storyText;
  66.     [SerializeField] State[] nextStates;
  67.     public string GetStateStory()
  68.     {
  69.         return storyText;
  70.     }
  71.  
  72.     public State[] GetNextStates()
  73.     {
  74.         return nextStates;
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement