Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (turbine == null)
        {
            return;
        }

        float price = turbine.GetComponent <PriceController>().price;

        turbineName.text   = turbine.turbineName;
        repairCosts.text   = ((1 - turbine.health) * price).ToString("0");
        destroyRefund.text = (price / 2 - (1 - turbine.health) * price / 2).ToString("0");

        UpdateInfoElements();
        UpdateGlobalInfo();
    }
Пример #2
0
 public void RemoveTurbine(TurbineController turbineController)
 {
     RemoveFromGridTiles(turbineController.gameObject.transform.position, turbineController.GetComponent <SizeController>().diameter + TerrainController.thisTerrainController.tileSize * 3);
     Destroy(turbineController.gameObject);
 }
Пример #3
0
    void CheckHighlight()
    {
        if (BuildMenuController.inBuildMode)
        {
            return;
        }

        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            GameObject hitObject = hit.collider.gameObject;

            TurbineController turbineController = hit.transform.GetComponentInParent <TurbineController>();
            if (turbineController != null)
            {
                turbineController.selectorObj.SetActive(true);
                turbineController.selectorObj.GetComponent <Projector>().orthographicSize *= turbineController.GetComponent <SizeController>().desiredScale;
            }

            //if (windVaneController != null)
            //    OpenWindVaneMenu(windVaneController);
        }
    }