Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. [RequireComponent(typeof(Node))]
  6. public class NodeRenderer : MonoBehaviour
  7. {
  8. private Node node;
  9. [SerializeField] private GameObject FullObject, PartialObject;
  10.  
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. node = GetComponent<Node>();
  15. node.changeInNodeState += UpdateGraphics;
  16. }
  17.  
  18. void UpdateGraphics(Node.NodeState state)
  19. {
  20. switch(state)
  21. {
  22. case Node.NodeState.Full:
  23. FullObject.SetActive(true);
  24. PartialObject.SetActive(false);
  25. break;
  26. case Node.NodeState.Partial:
  27. FullObject.SetActive(false);
  28. PartialObject.SetActive(true);
  29. break;
  30. case Node.NodeState.Depleted:
  31. FullObject.SetActive(false);
  32. PartialObject.SetActive(false);
  33. break;
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement