King placement prototype

>King can place objects on the race track
>It is based on their cursor location in 3D space
>Objects need to be switched for their proper abilities
>Objects need to snap to Grid
This commit is contained in:
Katherine
2021-12-10 21:46:42 -06:00
parent 98d69fdfea
commit 6fe14abe62
3 changed files with 21 additions and 19 deletions

View File

@@ -52,14 +52,8 @@ public class KingPlace : MonoBehaviour {
//Layout the grid
Grid.GetComponent<GridReveal>().GridSwitch(true);
//The player selects where on the grid they want to place the object
//The player can then see where the object will be placed, reletive to the Grid
Placing = true;
/* Center anchored
* Should be "simple" to snap the cursor poistion onto the grid.
*/
//The object is placed there
//Energy is spent
}
[SerializeField] private Camera KingCam;
@@ -71,6 +65,11 @@ public class KingPlace : MonoBehaviour {
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask)) {
Place.transform.position = RayCastHit.point;
}
if (Input.GetMouseButtonUp(1)) {//Reads the player letting up the right mouse button
Instantiate(Place);//Place the object (Snap it up and to Grid)
Grid.GetComponent<GridReveal>().GridSwitch(false); //Switch off the grid
Placing = false;//Stop placing
}
}
}
}