Merge branch 'KingPolishandPlaytestFeedbackbyKateWithTwoWeeksLefttoSGX'

This commit is contained in:
Katherine
2022-04-15 14:15:33 -05:00
26 changed files with 1682 additions and 63 deletions

View File

@@ -82,20 +82,16 @@ public class HailArea : NetworkBehaviour
if(distance < 0) {
distance *= -1;
}
if(distance <= 40) {
Debug.Log("100 Frames");
if(distance <= 60) {
timeMax = 100;
}
else if(distance > 40 && distance <= 180) {
Debug.Log("75 Frames");
else if(distance > 60 && distance <= 250) {
timeMax = 75;
}
else if (distance > 180 && distance <= 400) {
Debug.Log("50 Frames");
else if (distance > 250 && distance <= 500) {
timeMax = 50;
}
else if (distance > 400) {
Debug.Log("25 Frames");
else if (distance > 500) {
timeMax = 25;
}
}

View File

@@ -141,12 +141,13 @@ public class KingPlace : NetworkBehaviour
SlimeDir = DrawArrow();
if (Input.GetMouseButtonUp(0)) {//Reads the player releasing the left mouse button
Vector3 slimeLoc = PlaceTemp.transform.position;
Vector3 slimeLoc = PlaceTemp.transform.position;//Gets the Slime's position and rotation
Quaternion slimeRot = PlaceTemp.transform.rotation;
Destroy(PlaceTemp);
// PLACE NETWORKED VERSION
SpawnSlimeServerRPC(slimeLoc, SlimeDir);
SpawnSlimeServerRPC(slimeLoc, slimeRot, SlimeDir);
SlimePlacing = false;
MenuOff();
@@ -174,6 +175,7 @@ public class KingPlace : NetworkBehaviour
private GameObject Row;
private GameObject Platform;
Vector3 spawnLoc;
Quaternion spawnRot = Quaternion.identity;
private void FindGridBox() {
int RowNumb = 0, Box = 0, x = 0, z = 0;
if (PlaceTemp.transform.position.x < MontStr.x) {//King is trying to place on the mountain
@@ -195,6 +197,7 @@ public class KingPlace : NetworkBehaviour
found = true;
Vector3 rot = row.transform.rotation.eulerAngles;
PlaceTemp.transform.Rotate(0, (rot.y-90), 0);//Sets the object's rotation to the rows rotation
spawnRot = PlaceTemp.transform.rotation;
spawnLoc = new Vector3(box.transform.position.x-MountxOffset, PlaceTemp.transform.position.y, box.transform.position.z-MountzOffset);//Sets the object's location
break;//Breaks out from the loops when found
}
@@ -228,7 +231,7 @@ public class KingPlace : NetworkBehaviour
if (Place == BlockWithoutNetwork) {
// Have the server spawn the box
SpawnBoxServerRPC(spawnLoc);
SpawnBoxServerRPC(spawnLoc, spawnRot);
// Remove the reference to PlaceTemp
Destroy(PlaceTemp);
@@ -238,7 +241,7 @@ public class KingPlace : NetworkBehaviour
if (Place == BumperWithoutNetwork) {
//Server spawn Bumper
SpawnBumperServerRPC(spawnLoc);
SpawnBumperServerRPC(spawnLoc, spawnRot);
//Remove PlaceTemp
Destroy(PlaceTemp);
@@ -257,6 +260,8 @@ public class KingPlace : NetworkBehaviour
}
}
[SerializeField] private LayerMask GroundMask;
private void GridCheck(int Row, int Box, ref bool Placing) {//Makes it so items can only be placed in valid positions
GameObject RowTrue;
GameObject BoxTrue;
@@ -273,8 +278,12 @@ public class KingPlace : NetworkBehaviour
BoxTrue = null;
}
if (BoxTrue != null) {
Grid.GetComponent<GridReveal>().GridSwitch(false); //Switch off the grid
Placing = false;//Stop placing
//Check if there's something in the box, unless it's Hail, then it skips past
if (Physics.CheckSphere(BoxTrue.transform.GetChild(0).transform.position, BoxSize-1.5f, GroundMask) == false || PlaceTemp == HailSprite || Placing == HailPlacing)
{
Grid.GetComponent<GridReveal>().GridSwitch(false); //Switch off the grid
Placing = false;//Stop placing
}
}
}
}
@@ -305,7 +314,6 @@ public class KingPlace : NetworkBehaviour
if (HailCorner.transform.position.z <= (box.transform.position.z - MountzOffset) + boxsize / 2 && HailCorner.transform.position.z >= (box.transform.position.z - MountzOffset) - boxsize / 2)
{//Sees if the z fits within the box
found = true;
Vector3 rot = row.transform.rotation.eulerAngles;
HailCorner.transform.position = new Vector3(box.transform.position.x - MountxOffset, HailCorner.transform.position.y, box.transform.position.z - MountzOffset);//Sets the object's location
break;//Breaks out from the loops when found
}
@@ -348,7 +356,9 @@ public class KingPlace : NetworkBehaviour
MosPos = RayCastHit.point;
}
foreach (Transform child in PlaceTemp.transform) {
child.gameObject.SetActive(false);
if (child.gameObject.tag == "Arrow") { // Makes sure not to turn off the model
child.gameObject.SetActive(false);
}
}//y=x(PlaceTemp.y - PlaceTemp.x) y=-x(PlaceTemp.y - PlaceTemp.x)
if (MosPos.x > PlaceTemp.transform.position.x && MosPos.z < PlaceTemp.transform.position.z) {//Temp function to change Slime's dir
PlaceTemp.transform.Find("ArrowUP").gameObject.SetActive(true);
@@ -394,21 +404,23 @@ public class KingPlace : NetworkBehaviour
}
}
//ServerRPCs for spawning the King's abilities
[ServerRpc(RequireOwnership = false)]
private void SpawnBoxServerRPC(Vector3 spawnLoc) {
placedObj = Instantiate(Block, spawnLoc, Quaternion.identity);
private void SpawnBoxServerRPC(Vector3 spawnLoc, Quaternion spawnRot) {
placedObj = Instantiate(Block, spawnLoc, spawnRot);
placedObj.GetComponent<NetworkObject>().Spawn(null, true);
}
[ServerRpc(RequireOwnership = false)]
private void SpawnBumperServerRPC(Vector3 spawnLoc) {
placedObj = Instantiate(Bumper, spawnLoc, Quaternion.identity);
private void SpawnBumperServerRPC(Vector3 spawnLoc, Quaternion spawnRot) {
placedObj = Instantiate(Bumper, spawnLoc, spawnRot);
placedObj.GetComponent<NetworkObject>().Spawn(null, true);
}
[ServerRpc(RequireOwnership = false)]
private void SpawnSlimeServerRPC(Vector3 spawnLoc, int SlimeDir) {
placedObj = Instantiate(Slime, spawnLoc, Quaternion.identity);
private void SpawnSlimeServerRPC(Vector3 spawnLoc, Quaternion spawnRot, int SlimeDir) {
placedObj = Instantiate(Slime, spawnLoc, spawnRot);
placedObj.GetComponent<Slime>().GooStart(SlimeDir);

View File

@@ -7,6 +7,7 @@ public class RadialMenu : MonoBehaviour
{
bool UIOn = false;
bool ButtonUp = true;
public GameObject King;
public Camera cam;
@@ -14,28 +15,52 @@ public class RadialMenu : MonoBehaviour
[SerializeField]
private Text UItext;
private float xBound = 1920f;//Resolution
private float yBound = 1080f;
private float xSize;
private float ySize;
void Start()
{
xSize = GetComponent<RectTransform>().sizeDelta.x / 2;//Converts the size of the Panel into the bounds of the screen
ySize = GetComponent<RectTransform>().sizeDelta.y / 2;
xBound -= xSize;
yBound -= ySize;
}
// Update is called once per frame
void Update()
{
if (UIOn == false) {
screenPoint = Input.mousePosition;
screenPoint.z = 120f;
screenPoint.x = Mathf.Clamp(screenPoint.x, xSize, xBound);//Uses the calculated bounds to keep the UI on the screen
screenPoint.y = Mathf.Clamp(screenPoint.y, ySize, yBound);
transform.position = cam.ScreenToWorldPoint(screenPoint);//Moved the UI to where the mouse is
}
if(Input.GetAxis("RadialMenu") > 0) {//Pressing Q makes the UI appear
if(Input.GetAxis("RadialMenu") > 0 && UIOn == false && ButtonUp == true) {//Pressing Q makes the UI appear, if it is off
ButtonUp = false;
if (King.GetComponent<KingPlace>().FirstPlacing == true) {
King.GetComponent<KingPlace>().CancelPlacing();
}
MenuOn();
}
if (Input.GetAxis("RadialMenu") < 0) {//Pressing E makes the UI dissapear
else if (Input.GetAxis("RadialMenu") > 0 && UIOn == true && ButtonUp == true) {//Pressing Q makes the UI dissapear, if it is on
ButtonUp = false;
MenuOff();
}
if(Input.GetAxis("RadialMenu") == 0)
{
ButtonUp = true;
}
}
private void MenuOn()
{
UItext.text = "Press E to Close Menu";
UItext.text = "Press Q to Close Menu";
foreach (Transform child in transform) { //Turns on all of the different buttons attached to this panel and stops it from moving
child.gameObject.SetActive(true);
UIOn = true;