Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- [RequireComponent(typeof(Node))]
- public class NodeRenderer : MonoBehaviour
- {
- private Node node;
- [SerializeField] private GameObject FullObject, PartialObject;
- // Start is called before the first frame update
- void Start()
- {
- node = GetComponent<Node>();
- node.changeInNodeState += UpdateGraphics;
- }
- void UpdateGraphics(Node.NodeState state)
- {
- switch(state)
- {
- case Node.NodeState.Full:
- FullObject.SetActive(true);
- PartialObject.SetActive(false);
- break;
- case Node.NodeState.Partial:
- FullObject.SetActive(false);
- PartialObject.SetActive(true);
- break;
- case Node.NodeState.Depleted:
- FullObject.SetActive(false);
- PartialObject.SetActive(false);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement