Ejemplo n.º 1
0
    public void SelectPoint(L_BuildPoint point)
    {
        if (selectPoint == point)
        {
            DeselectPlace();
            return;
        }

        selectPoint = point;
        towerInfo   = null;
    }
Ejemplo n.º 2
0
 public void DeselectPlace()
 {
     selectPoint = null;
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[0];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[0].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[1];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[1].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[2];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[2].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[3];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[3].GetComponent <Image>().color = Color.green;
        }
        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[4];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[4].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[5];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[5].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            unitToSpawn = bk_BuildLog.instance.soliderUnits[6];
            L_BuildManager.instance.SelectTurretToBuild(unitToSpawn);
            revertallButtonPanels();
            listofButtonImages[6].GetComponent <Image>().color = Color.green;
        }

        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100.0f))
            {
                if (hit.transform != null && hit.transform.gameObject.name == "Spawner")
                {
                    if (indicatorToTurnOff == null)
                    {
                        spawningPlace      = hit.transform.gameObject.GetComponent <L_BuildPoint>();
                        indicatorToTurnOff = hit.transform.gameObject.transform.GetChild(0).gameObject;
                        indicatorToTurnOff.SetActive(true);
                    }
                    else
                    {
                        indicatorToTurnOff.SetActive(false);
                        spawningPlace      = hit.transform.gameObject.GetComponent <L_BuildPoint>();
                        indicatorToTurnOff = hit.transform.gameObject.transform.GetChild(0).gameObject;
                        indicatorToTurnOff.SetActive(true);
                    }
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Space) && unitToSpawn.prefab != null && spawningPlace != null)
        {
            spawningPlace.BuildTurret(L_BuildManager.instance.GetTurretToBuild());
        }
    }