Пример #1
0
    public void SaleTurret(TurretScript ts)
    {
        stageController.gold += ts.GetSaleGold();
        GameObject.Find("TurretUpdateUI").GetComponent <TurretUpdateUIController>().HideTurretInfo();

        Vector3Int aPos = mapController.WorldToArray(ts.GetPosition());

        mapController.mapArray[aPos.x, aPos.y] = Utils.GROUND;

        DeleteTurret(ts);

        AudioManager.instance.PlaySound("se_sell");


        //敌人改变默认路径
        GameObject.Find("Map").GetComponent <PathFinder>().RefreshDefaultPath();
    }
Пример #2
0
    public void ShowTurretInfo(TurretScript ts)
    {
        //showing = true;

        selected = ts;
        SetLocalPosition(ts.GetPosition());
        //updateUI.GetComponent<RectTransform>().anchoredPosition = ts.GetPosition ();

        if (ts.level >= ts.maxLevel)
        {
            update.interactable = false;
            updateText.text     = "--";
        }
        else
        {
            update.interactable = true;
            //Debug.Log("enemy's price is " + ts.price);
            updateText.text = "$" + ts.GetUpdateGold();
        }

        sale.interactable = true;
        saleText.text     = "$" + ts.GetSaleGold();

        levelText.text = (ts.level >= ts.maxLevel) ? "Max" : ts.level + "";

        //GameObject.Find("DrawToolkit").GetComponent<DrawToolkit>().DrawCircle(ts.transform .position , ts.range );

        RectTransform rt = GameObject.Find("Range").GetComponent <RectTransform>();

        rt.anchoredPosition = GetUIPosition(ts.transform.position);


        float range = Utils.LengthLocalToUI(ts.range * 2 * GameObject.Find("Map").GetComponent <MapController>().cellLocalSize);


        rt.sizeDelta = new Vector2(range, range);
    }