daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top