Inheritance: MonoBehaviour
 void Start()
 {
     //set the class objects
             ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript in scen
             towerManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
             buildCanvas.SetActive(false);
 }
    private void SelectionInput()
    {
        RaycastHit hitInfo;
        if (Physics.Raycast(rightHand.transform.position, rightHand.transform.forward, out hitInfo, Mathf.Infinity, raycastMask))
        {
            pointerHead.transform.position = hitInfo.point;
            lineRenderer.SetPosition(0, rightHand.transform.position);
            lineRenderer.SetPosition(1, hitInfo.point);

            if (true)
            {
                buttonScript uiButton;
                if (hitInfo.collider.gameObject.TryGetComponent(out uiButton))
                {
                    uiButton.SelectButton();
                    selectedButton = uiButton;
                }

            }
        }
        else
        {
            selectedButton = null;
            pointerHead.transform.position = rightHand.transform.position + rightHand.transform.forward * 1.2f;
            lineRenderer.SetPosition(0, rightHand.transform.position);
            lineRenderer.SetPosition(1, rightHand.transform.position + rightHand.transform.forward * 1.2f);
        }
    }
Beispiel #3
0
    public buttonScript clrload;//tambahkansendiri warnanya

    private void Start()
    {
        clrred  = GameObject.Find("red").GetComponent(typeof(buttonScript)) as buttonScript;
        clrsave = GameObject.Find("save").GetComponent(typeof(buttonScript)) as buttonScript;
        clrload = GameObject.Find("load").GetComponent(typeof(buttonScript)) as buttonScript;
        names   = GameObject.Find("dataobjek").GetComponent(typeof(dataobjek)) as dataobjek;
    }
    void Start()
    {
        //set the class objects
        ButtonScript    = GameObject.Find("Canvas/Panel").GetComponent <buttonScript>(); //get a refference to the buttonscript u=in scen
        canvaStatsPanel = ButtonScript.statPanel;                                        //Should send this unit's stats to the panel
        statsLabel      = canvaStatsPanel.GetComponentInChildren <Text>();

        towerManager    = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent <TowerManager>();
        selectionCircle = transform.Find("selectPlane");
        selectionCircle.gameObject.SetActive(false);
        enemiesInRange = new List <GameObject>(); //Get alist of enemeies in range
        lastShotTime   = Time.time;
        towerData      = gameObject.GetComponentInChildren <TowerData>();
    }
Beispiel #5
0
    void buttonOnClick(buttonScript b)
    {
        Debug.Log(isOpen);
        Debug.Log("clicked");
        GameObject buffer1, buffer2;

        buffer1 = b.currentObject;
        buffer2 = heldObject;

        buffer2.transform.SetParent(buffer1.transform.parent);
        buffer2.transform.position = buffer1.transform.parent.position;
        buffer1.transform.SetParent(panel.gameObject.transform);

        b.currentObject = buffer2;
        heldObject      = buffer1;
    }
Beispiel #6
0
    void resetOtherButtons()
    {
        GameObject[] buildButtons = GameObject.FindGameObjectsWithTag("buttons");

        foreach (GameObject buildButton in buildButtons)
        {
            if (buildButton.name == uiButton.name)
            {
                continue;
            }
            else if (buildButton.name.Contains("Tower"))
            {
                //Debug.Log("Unclick button name: " + towerButton.name);
                buttonScript other = buildButton.GetComponent(typeof(buttonScript)) as buttonScript;
                other.unclickButton();
            }
            else if (buildButton.name.Contains("Power"))
            {
                buttonPowerStationScript other = buildButton.GetComponent <buttonPowerStationScript>();
                other.unclickButton();
            }
        }
    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     ButtonScript    = GameObject.Find("Canvas/Panel").GetComponent <buttonScript>(); //get a refference to the buttonscript u=in scen
     canvaStatsPanel = ButtonScript.statPanel;
     selectManager   = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent <TowerManager>();
 }
 // Use this for initialization
 void Start()
 {
     ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript u=in scen
     canvaStatsPanel = ButtonScript.statPanel;
     selectManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
 }
    void Start()
    {
        //set the class objects
        ButtonScript = GameObject.Find("Canvas/Panel").GetComponent<buttonScript>(); //get a refference to the buttonscript u=in scen
        canvaStatsPanel = ButtonScript.statPanel; //Should send this unit's stats to the panel
        statsLabel = canvaStatsPanel.GetComponentInChildren<Text>();

        towerManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent<TowerManager>();
        selectionCircle = transform.Find("selectPlane");
        selectionCircle.gameObject.SetActive(false);
        enemiesInRange = new List<GameObject>(); //Get alist of enemeies in range
        lastShotTime = Time.time;
        towerData = gameObject.GetComponentInChildren<TowerData>();
    }
 void Start()
 {                                                                                 //set the class objects
     ButtonScript = GameObject.Find("Canvas/Panel").GetComponent <buttonScript>(); //get a refference to the buttonscript in scen
     towerManager = GameObject.FindGameObjectWithTag("PlayerTowerManager").GetComponent <TowerManager>();
     buildCanvas.SetActive(false);
 }