示例#1
0
    public void ShowGUI(GameObject thing)
    {
        guiTarget = thing;

        if(thing)
        {
            BaseScript = guiTarget.GetComponent<BaseStructureScript>();

            if(guiTarget.name == "BasicTower(Clone)")
            {
                rapidButtonTexture.enabled = true;
                sniperButtonTexture.enabled = true;
                heavyButtonTexture.enabled = true;
            }
            else{
                rapidButtonTexture.enabled = false;
                sniperButtonTexture.enabled = false;
                heavyButtonTexture.enabled = false;
            }
            sellButtonTexture.enabled = true;
            selectArrow.transform.position = new Vector3(guiTarget.transform.position.x,guiTarget.transform.position.y+0.8f,0);
            //guiTarget.transform.position;
            selectArrow.renderer.enabled = true;
        }

        else
        {
            BaseScript = null;
            rapidButtonTexture.enabled = false;
            sniperButtonTexture.enabled = false;
            heavyButtonTexture.enabled = false;
            sellButtonTexture.enabled = false;
            selectArrow.renderer.enabled = false;
        }
    }
示例#2
0
 //sets heldObject to the object with the name in pLacebleObjects at position 'heldObjectNum'
 void setHeldObject()
 {
     heldObject = Instantiate(Resources.Load("Structures/" + pLacebleObjects[heldObjectNum]),transform.position, Quaternion.identity) as GameObject;
     heldObject.transform.GetChild(1).gameObject.renderer.material.color = new Color(0.4f,0f,0f,0.5f);
     heldObjectScript = heldObject.gameObject.GetComponent<BaseStructureScript> ();
     heldObjectScript.controllScript = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameControllScript>();
 }