Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        _sr            = this.transform.GetComponent <SpriteRenderer>();
        _sStatedefault = Resources.Load <Sprite>("Buildings/DirtMound/dirt_mound_final");


        //SetUp the NotifyObj
        _srNotify = _NotificationObject.transform.GetComponent <SpriteRenderer>();

        _sNotification   = Resources.Load <Sprite>("UI/Exclamation_Icon");
        _srNotify.sprite = _sNotification;

        _animator = GetComponentInChildren <Animator>();

        if (eType == BuildingType.Vacant)
        {
            eState     = BuildingState.Available;
            _sr.sprite = _sStatedefault;

            //Possible error here in assigning something to be a dirtmound
            if (eType == BuildingType.Vacant)
            {
                setTeam(500); // default value for destroyed state
            }
        }


        //Other classes
        GameObject o = GameObject.FindGameObjectWithTag("BuildMenu");

        _BuildMenu        = o.GetComponent <UIBuildMenu>();
        o                 = GameObject.FindGameObjectWithTag("DestroyMenu");
        _DestroyMenu      = o.GetComponent <UIBuildMenu>();
        o                 = GameObject.FindGameObjectWithTag("BuildingCapWarning");
        _BuildingCapMenu  = o.GetComponent <UIBuildMenu>();
        _cameraController = Camera.main.GetComponent <CameraController>();


        //little unnecessary
        _controller = MVCController.Instance;

        //Health Bar Prefab
        if (_HealthBarObj == null)
        {
            _HealthBarObj = Resources.Load <GameObject>("UI/HealthBarCanvas");
        }
        SetUpHealthBar(_HealthBarObj.gameObject);

        //Construction Bar Prefab
        if (_ConstructionBarObj == null)
        {
            _ConstructionBarObj = Resources.Load <GameObject>("UI/ConstructionBarCanvas");
        }
        SetUpConstructionBar(_ConstructionBarObj);

        UpdateState();
        setUpWorkers();
        UpdateHealthBar();

        //Feel like these could load in a different order on start
        _ID = GameManager.Instance.getBuildingIndex();
        // Debug.Log(this.gameObject + " ID is: " + _ID);

        setUpInstantConstruction();
    }
Exemplo n.º 2
0
 public void SetUpBuildMenu(UIBuildMenu bm)
 {
     _BuildMenu = bm;
 }
Exemplo n.º 3
0
 public void Init(UIBuildMenu _menu, UIButton _button)
 {
     menu   = _menu;
     button = _button;
 }
Exemplo n.º 4
0
 public static void UpdateUI(UIBuildMenu __instance)
 {
     dragSelectButton.gameObject.SetActive(__instance.isDismantleMode);
     dragSelectButton.highlighted = __instance.dismantleTool.cursorType == 2;
 }