/// <summary>
        /// Sees what object is touched.
        /// </summary>
        public void CheckObjectITouched()
        {
            RaycastHit hit;

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

            //This causes a line to come out from the camera to the place the player tapped. It will let you know the first thing it hits.
            if (Physics.Raycast(ray, out hit, 100.0f))
            {
                if (hit.transform.tag == "Enemy")
                {
                    targetedEnemy = hit.transform.GetComponent <Enemy>();
                }
                else if (waveInProgress == false && hit.transform.tag == "Plot" && !towerBuilder.towerBuilderUI.gameObject.activeInHierarchy)
                {
                    PlotNode newNode = hit.transform.GetComponent <PlotNode>();
                    if (newNode.tower == null)
                    {
                        towerBuilder.SlectedPlotToBuild(newNode);
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Called when player selcts a PlotNode to build on.
 /// </summary>
 /// <param name="plot">The PlotNode selected.</param>
 public void SlectedPlotToBuild(PlotNode plot)
 {
     selectedNodeToBuildOn = plot;
     DisplayTowerSelection();
 }