mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
Revert King Back To non controller
This commit is contained in:
parent
b9045356d4
commit
2c9f5ad6ce
|
|
@ -26,7 +26,7 @@ public class KingPlace : NetworkBehaviour
|
|||
private GameObject Place;
|
||||
private GameObject PlaceTemp = null;
|
||||
private GameObject HailCorner;
|
||||
|
||||
|
||||
public bool FirstPlacing = false;
|
||||
private bool HailPlacing = false;
|
||||
private bool SlimePlacing = false;
|
||||
|
|
@ -43,7 +43,7 @@ public class KingPlace : NetworkBehaviour
|
|||
private KingAbility KABump = new KingAbility(6, 10);
|
||||
|
||||
|
||||
private float[] MountPlats = { 302f, 314f, 329f, 344f, 359f, 399f, 414f, 429f, 469f, 484f, 499f, 514f};
|
||||
private float[] MountPlats = { 302f, 314f, 329f, 344f, 359f, 399f, 414f, 429f, 469f, 484f, 499f, 514f };
|
||||
private float[] MountxOffsets = { -50f, -73.4f, -100f, -127f, -134.7f, -130f, -34f, 14.5f, 91.2f, 129f, 129.5f };
|
||||
private float[] MountzOffsets = { 130f, 120f, 97f, 56.6f, 32f, -50f, -135.5f, -138.5f, -105f, -52.5f, 50f };
|
||||
|
||||
|
|
@ -52,20 +52,23 @@ public class KingPlace : NetworkBehaviour
|
|||
|
||||
private GameObject placedObj;
|
||||
|
||||
void Start() {
|
||||
void Start()
|
||||
{
|
||||
KABlock.KingButton(Panel.transform.GetChild(0).gameObject);//Grabs each button from the
|
||||
KASlime.KingButton(Panel.transform.GetChild(2).gameObject);
|
||||
KAHail.KingButton(Panel.transform.GetChild(1).gameObject);
|
||||
KABump.KingButton(Panel.transform.GetChild(3).gameObject);
|
||||
|
||||
// Only try to grab references if we are actually in the game scene
|
||||
if (SceneManager.GetActiveScene().buildIndex == 3) {
|
||||
if (SceneManager.GetActiveScene().buildIndex == 3)
|
||||
{
|
||||
Grid = GameObject.FindGameObjectWithTag("KingGrid");
|
||||
MountGrid = GameObject.FindGameObjectWithTag("MountainGrid");
|
||||
try
|
||||
{
|
||||
Grid.GetComponent<GridReveal>().ToggleMountainGrid(false);
|
||||
} catch(NullReferenceException e)
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
|
|
@ -73,10 +76,12 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
|
||||
bool Avaliable;
|
||||
public void PlaceObject(int ID) { //Is called when trhe King clicks the Block,Hail,or Slime button
|
||||
public void PlaceObject(int ID)
|
||||
{ //Is called when trhe King clicks the Block,Hail,or Slime button
|
||||
//Switch statement, ID-0 = Block,ID-1 = Hail,ID-2 = Slime,ID-3 = Bumper
|
||||
Avaliable = false;
|
||||
switch (ID) {//Parses in the button clicked into the right object that the King is placing
|
||||
switch (ID)
|
||||
{//Parses in the button clicked into the right object that the King is placing
|
||||
case 0:
|
||||
Place = BlockWithoutNetwork;
|
||||
Avaliable = KABlock.IsAvaliable();
|
||||
|
|
@ -94,7 +99,8 @@ public class KingPlace : NetworkBehaviour
|
|||
Avaliable = KABump.IsAvaliable();
|
||||
break;
|
||||
}
|
||||
if (Avaliable == true) {
|
||||
if (Avaliable == true)
|
||||
{
|
||||
MenuOff();
|
||||
Panel.GetComponent<RadialMenu>().PlaceObj(ID);
|
||||
//Create the object that will follow the Mouse
|
||||
|
|
@ -107,59 +113,54 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void MenuOff() {
|
||||
private void MenuOff()
|
||||
{
|
||||
Panel.GetComponent<RadialMenu>().MenuOff();
|
||||
}
|
||||
|
||||
[SerializeField] private Camera KingCam;
|
||||
[SerializeField] private LayerMask LayerMask;
|
||||
|
||||
private void Update() {
|
||||
if (FirstPlacing == true) {
|
||||
Ray Ray;
|
||||
if (this.transform.Find("kingCursor").gameObject.activeInHierarchy)
|
||||
private void Update()
|
||||
{
|
||||
if (FirstPlacing == true)
|
||||
{
|
||||
Ray Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask))
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay(this.transform.Find("kingCursor").gameObject.transform.position);//Raycast to find the point where the mouse cursor is
|
||||
}
|
||||
else
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
}
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask)) {
|
||||
PlaceTemp.transform.position = RayCastHit.point;
|
||||
}
|
||||
if (Input.GetMouseButtonDown(0)) {//Reads the player clicking the left mouse button
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{//Reads the player clicking the left mouse button
|
||||
FindGridBox();
|
||||
}
|
||||
if (Input.GetMouseButtonUp(1)) {//Reads the player pressing the right mouse button
|
||||
if (Input.GetMouseButtonUp(1))
|
||||
{//Reads the player pressing the right mouse button
|
||||
CancelPlacing();
|
||||
}
|
||||
}
|
||||
if (HailPlacing == true) {
|
||||
if (HailPlacing == true)
|
||||
{
|
||||
Ray Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
if (this.transform.Find("kingCursor").gameObject.activeInHierarchy)
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask))
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay(this.transform.Find("kingCursor").gameObject.transform.position);//Raycast to find the point where the mouse cursor is
|
||||
}
|
||||
else
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
}
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask)) {
|
||||
HailCorner.transform.position = RayCastHit.point;
|
||||
HailCorner.GetComponent<LineRenderer>().SetPosition(1, new Vector3(HailCorner.transform.position.x, HailCorner.transform.position.y + 35, PlaceTemp.transform.position.z));
|
||||
HailCorner.GetComponent<LineRenderer>().SetPosition(2, new Vector3(HailCorner.transform.position.x, HailCorner.transform.position.y + 35, HailCorner.transform.position.z));
|
||||
HailCorner.GetComponent<LineRenderer>().SetPosition(3, new Vector3(PlaceTemp.transform.position.x, HailCorner.transform.position.y + 35, HailCorner.transform.position.z));
|
||||
}
|
||||
if (Input.GetMouseButtonUp(0) || Input.GetKeyUp(KeyCode.JoystickButton0)) {//Reads the player releasing the left mouse button
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
{//Reads the player releasing the left mouse button
|
||||
CreateHail();
|
||||
MenuOff();
|
||||
KAHail.UseItem();
|
||||
}
|
||||
}
|
||||
if (SlimePlacing == true) {
|
||||
if (SlimePlacing == true)
|
||||
{
|
||||
SlimeDir = DrawArrow();
|
||||
if (Input.GetMouseButtonUp(0) || Input.GetKeyUp(KeyCode.JoystickButton0)) {//Reads the player releasing the left mouse button
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
{//Reads the player releasing the left mouse button
|
||||
|
||||
Vector3 slimeLoc = PlaceTemp.transform.position;//Gets the Slime's position and rotation
|
||||
Quaternion slimeRot = PlaceTemp.transform.rotation;
|
||||
|
|
@ -177,13 +178,15 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
public void CancelPlacing() {//Allows the player to cancel out a button press
|
||||
public void CancelPlacing()
|
||||
{//Allows the player to cancel out a button press
|
||||
Destroy(PlaceTemp);
|
||||
Grid.GetComponent<GridReveal>().GridSwitch(false);
|
||||
FirstPlacing = false;
|
||||
}
|
||||
|
||||
private void FixedUpdate() {
|
||||
private void FixedUpdate()
|
||||
{
|
||||
CooldownTimer();
|
||||
EnergyRefill();
|
||||
}
|
||||
|
|
@ -197,34 +200,44 @@ public class KingPlace : NetworkBehaviour
|
|||
private GameObject Platform;
|
||||
Vector3 spawnLoc;
|
||||
Quaternion spawnRot = Quaternion.identity;
|
||||
private void FindGridBox() {
|
||||
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
|
||||
if (PlaceTemp.transform.position.x < MontStr.x)
|
||||
{//King is trying to place on the mountain
|
||||
Platform = null;
|
||||
bool found = false;
|
||||
for(int i = 0; i < MountPlats.Length-1; i++) {
|
||||
if (MountPlats[i] <= PlaceTemp.transform.position.y && MountPlats[i+1] >= PlaceTemp.transform.position.y) {//Finds the platform by comparing y values
|
||||
for (int i = 0; i < MountPlats.Length - 1; i++)
|
||||
{
|
||||
if (MountPlats[i] <= PlaceTemp.transform.position.y && MountPlats[i + 1] >= PlaceTemp.transform.position.y)
|
||||
{//Finds the platform by comparing y values
|
||||
Platform = MountGrid.transform.Find("Platform" + i).gameObject;//Sets the platform and offsets for that platform
|
||||
MountxOffset = MountxOffsets[i];
|
||||
MountzOffset = MountzOffsets[i];
|
||||
break;//Breaks out when it finds the platform
|
||||
}
|
||||
}
|
||||
if (Platform != null) {//Makes sure it found a platform, so there are no null refs
|
||||
foreach (Transform row in Platform.transform) { //Looks through every row on the platform
|
||||
foreach (Transform box in row) {//Looks at every Box in the row
|
||||
if (PlaceTemp.transform.position.x <= (box.transform.position.x-MountxOffset) + boxsize / 2 && PlaceTemp.transform.position.x >= (box.transform.position.x-MountxOffset) - boxsize / 2) {//Sees if the x fits within the box
|
||||
if (PlaceTemp.transform.position.z <= (box.transform.position.z-MountzOffset) + boxsize / 2 && PlaceTemp.transform.position.z >= (box.transform.position.z-MountzOffset) - boxsize / 2) {//Sees if the z fits within the box
|
||||
if (Platform != null)
|
||||
{//Makes sure it found a platform, so there are no null refs
|
||||
foreach (Transform row in Platform.transform)
|
||||
{ //Looks through every row on the platform
|
||||
foreach (Transform box in row)
|
||||
{//Looks at every Box in the row
|
||||
if (PlaceTemp.transform.position.x <= (box.transform.position.x - MountxOffset) + boxsize / 2 && PlaceTemp.transform.position.x >= (box.transform.position.x - MountxOffset) - boxsize / 2)
|
||||
{//Sees if the x fits within the box
|
||||
if (PlaceTemp.transform.position.z <= (box.transform.position.z - MountzOffset) + boxsize / 2 && PlaceTemp.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;
|
||||
PlaceTemp.transform.Rotate(0, (rot.y-90), 0);//Sets the object's rotation to the rows rotation
|
||||
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
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == true) {//Stops it from going through all the rows
|
||||
if (found == true)
|
||||
{//Stops it from going through all the rows
|
||||
Grid.GetComponent<GridReveal>().GridSwitch(false); //Switch off the grid
|
||||
FirstPlacing = false;
|
||||
break;
|
||||
|
|
@ -232,7 +245,8 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
float i = ((PlaceTemp.transform.position.x) - xOffset) / -BoxSize; //Finds the Row the cursor is in
|
||||
RowNumb = (int)i; //Rounds it down
|
||||
float y = ((PlaceTemp.transform.position.z) - zOffset) / -BoxSize; //Finds the Box in the Row the cursor is in
|
||||
|
|
@ -246,11 +260,13 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
|
||||
// Instantiate a networked box at the position
|
||||
if (FirstPlacing == false) {
|
||||
if (FirstPlacing == false)
|
||||
{
|
||||
|
||||
PlaceTemp.transform.position = spawnLoc;
|
||||
|
||||
if (Place == BlockWithoutNetwork) {
|
||||
if (Place == BlockWithoutNetwork)
|
||||
{
|
||||
// Have the server spawn the box
|
||||
SpawnBoxServerRPC(spawnLoc, spawnRot);
|
||||
|
||||
|
|
@ -260,7 +276,8 @@ public class KingPlace : NetworkBehaviour
|
|||
KABlock.UseItem();
|
||||
}
|
||||
|
||||
if (Place == BumperWithoutNetwork) {
|
||||
if (Place == BumperWithoutNetwork)
|
||||
{
|
||||
//Server spawn Bumper
|
||||
SpawnBumperServerRPC(spawnLoc, spawnRot);
|
||||
|
||||
|
|
@ -270,10 +287,12 @@ public class KingPlace : NetworkBehaviour
|
|||
KABump.UseItem();
|
||||
}
|
||||
|
||||
if (Place == SlimeWithoutNetwork) {//If Object is Hail or Slime set the respective Placing value to true so it can launch into the secondary placing function
|
||||
if (Place == SlimeWithoutNetwork)
|
||||
{//If Object is Hail or Slime set the respective Placing value to true so it can launch into the secondary placing function
|
||||
SlimePlacing = true;
|
||||
}
|
||||
else if (Place == HailSprite) {
|
||||
else if (Place == HailSprite)
|
||||
{
|
||||
Grid.GetComponent<GridReveal>().GridSwitch(true);
|
||||
HailPlacing = true;
|
||||
HailCorner = Instantiate(Place);
|
||||
|
|
@ -284,24 +303,33 @@ 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
|
||||
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;
|
||||
try {
|
||||
try
|
||||
{
|
||||
RowTrue = Grid.transform.Find("Row" + Row).gameObject;
|
||||
} catch {
|
||||
}
|
||||
catch
|
||||
{
|
||||
RowTrue = null;
|
||||
}
|
||||
|
||||
if (RowTrue != null) {
|
||||
try {
|
||||
if (RowTrue != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
BoxTrue = RowTrue.transform.Find("GridChunk" + Box).gameObject;
|
||||
} catch {
|
||||
}
|
||||
catch
|
||||
{
|
||||
BoxTrue = null;
|
||||
}
|
||||
if (BoxTrue != null) {
|
||||
if (BoxTrue != null)
|
||||
{
|
||||
//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-3f, GroundMask) == false || PlaceTemp == HailSprite || Placing == HailPlacing)
|
||||
if (Physics.CheckSphere(BoxTrue.transform.GetChild(0).transform.position, BoxSize - 3f, GroundMask) == false || PlaceTemp == HailSprite || Placing == HailPlacing)
|
||||
{
|
||||
Grid.GetComponent<GridReveal>().GridSwitch(false); //Switch off the grid
|
||||
Placing = false;//Stop placing
|
||||
|
|
@ -310,12 +338,14 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void CreateHail() {
|
||||
private void CreateHail()
|
||||
{
|
||||
if (PlaceTemp.transform.position.x < MontStr.x)
|
||||
{//King is trying to place on the mountain
|
||||
Platform = null;
|
||||
bool found = false;
|
||||
for (int i = 0; i < MountPlats.Length-1; i++) {
|
||||
for (int i = 0; i < MountPlats.Length - 1; i++)
|
||||
{
|
||||
if (MountPlats[i] <= PlaceTemp.transform.position.y && MountPlats[i + 1] >= PlaceTemp.transform.position.y)
|
||||
{//Finds the platform by comparing y values
|
||||
Platform = MountGrid.transform.Find("Platform" + i).gameObject;//Sets the platform and offsets for that platform
|
||||
|
|
@ -361,7 +391,8 @@ public class KingPlace : NetworkBehaviour
|
|||
GridCheck(RowNumb, Box, ref HailPlacing);//Makes sure the Box is a valid position
|
||||
}
|
||||
//Instanciate HailArea based on PlaceTemp = Top Left and HailCorner = Bottom Right
|
||||
if (HailPlacing == false) {
|
||||
if (HailPlacing == false)
|
||||
{
|
||||
Vector4 spawnLoc = new Vector4(PlaceTemp.transform.position.x, HailCorner.transform.position.x, PlaceTemp.transform.position.z, HailCorner.transform.position.z);
|
||||
SpawnHailServerRPC(spawnLoc);
|
||||
|
||||
|
|
@ -370,26 +401,20 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private int DrawArrow() { //TODO Fix how it determines where to point
|
||||
private int DrawArrow()
|
||||
{ //TODO Fix how it determines where to point
|
||||
Vector3 MosPos = new Vector3(0, 0, 0);
|
||||
GameObject Arrow = null;
|
||||
int DirNumber = 2;//Defaults to down, just in case
|
||||
|
||||
Ray Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
if (this.transform.Find("kingCursor").gameObject.activeInHierarchy)
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask))
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay((this.transform.Find("kingCursor").gameObject.transform.position));//Raycast to find the point where the mouse cursor is
|
||||
MosPos = RayCastHit.point;
|
||||
}
|
||||
else
|
||||
foreach (Transform child in PlaceTemp.transform)
|
||||
{
|
||||
Ray = KingCam.ScreenPointToRay(Input.mousePosition);//Raycast to find the point where the mouse cursor is
|
||||
}
|
||||
|
||||
if (Physics.Raycast(Ray, out RaycastHit RayCastHit, float.MaxValue, LayerMask)) {
|
||||
MosPos = RayCastHit.point;
|
||||
}
|
||||
foreach (Transform child in PlaceTemp.transform) {
|
||||
if (child.gameObject.tag == "Arrow") { // Makes sure not to turn off the model
|
||||
if (child.gameObject.tag == "Arrow")
|
||||
{ // Makes sure not to turn off the model
|
||||
child.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
|
|
@ -400,23 +425,28 @@ public class KingPlace : NetworkBehaviour
|
|||
|
||||
Vector3 Dir = (MosPos - PlaceTemp.transform.position).normalized;//Finds the direction to the Mouse
|
||||
|
||||
if (Dir.z <= -.8f) {//Set of If statements that determine the direction of the Slime, relative to the Mouse's Position
|
||||
if (Dir.z <= -.8f)
|
||||
{//Set of If statements that determine the direction of the Slime, relative to the Mouse's Position
|
||||
Arrow = PlaceTemp.transform.Find("ArrowUP").gameObject;
|
||||
DirNumber = 0;//Up
|
||||
}
|
||||
else if (Dir.x <= -.8f) {
|
||||
else if (Dir.x <= -.8f)
|
||||
{
|
||||
Arrow = PlaceTemp.transform.Find("ArrowRIGHT").gameObject;
|
||||
DirNumber = 1;//Right
|
||||
}
|
||||
else if (Dir.z >= .8f) {
|
||||
else if (Dir.z >= .8f)
|
||||
{
|
||||
Arrow = PlaceTemp.transform.Find("ArrowDOWN").gameObject;
|
||||
DirNumber = 2;//Down
|
||||
}
|
||||
else if (Dir.x >= .8f) {
|
||||
else if (Dir.x >= .8f)
|
||||
{
|
||||
Arrow = PlaceTemp.transform.Find("ArrowLEFT").gameObject;
|
||||
DirNumber = 3;//Left
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Arrow = PlaceTemp.transform.Find("ArrowDOWN").gameObject; //Defaults to down
|
||||
}
|
||||
|
||||
|
|
@ -424,27 +454,33 @@ public class KingPlace : NetworkBehaviour
|
|||
SlimeBody.transform.LookAt(Arrow.transform);
|
||||
SlimeBody.transform.Rotate(0, -90, -5);
|
||||
return DirNumber;
|
||||
}
|
||||
}
|
||||
|
||||
private void CooldownTimer() {// Function for tracking the individual cooldowns of the items. It's done in a two-teired system to allow the cooldowns to be eaisly converted as seconds
|
||||
private void CooldownTimer()
|
||||
{// Function for tracking the individual cooldowns of the items. It's done in a two-teired system to allow the cooldowns to be eaisly converted as seconds
|
||||
KABlock.Cooldown();
|
||||
KAHail.Cooldown();
|
||||
KASlime.Cooldown();
|
||||
KABump.Cooldown();
|
||||
}
|
||||
|
||||
private bool SpendEnergy(KingAbility Ability) {
|
||||
if (Energy > Ability.Energy()) {
|
||||
private bool SpendEnergy(KingAbility Ability)
|
||||
{
|
||||
if (Energy > Ability.Energy())
|
||||
{
|
||||
Energy -= Ability.Energy();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void EnergyRefill() {
|
||||
if(Energy < 100) {
|
||||
private void EnergyRefill()
|
||||
{
|
||||
if (Energy < 100)
|
||||
{
|
||||
Energy++;
|
||||
}
|
||||
}
|
||||
|
|
@ -452,19 +488,22 @@ public class KingPlace : NetworkBehaviour
|
|||
|
||||
//ServerRPCs for spawning the King's abilities
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
private void SpawnBoxServerRPC(Vector3 spawnLoc, Quaternion spawnRot) {
|
||||
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, Quaternion spawnRot) {
|
||||
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, Quaternion spawnRot, Quaternion slimeBodyRot, int SlimeDir) {
|
||||
private void SpawnSlimeServerRPC(Vector3 spawnLoc, Quaternion spawnRot, Quaternion slimeBodyRot, int SlimeDir)
|
||||
{
|
||||
placedObj = Instantiate(Slime, spawnLoc, spawnRot);
|
||||
placedObj.transform.GetChild(0).rotation = slimeBodyRot;
|
||||
placedObj.GetComponent<Slime>().GooStart(SlimeDir);
|
||||
|
|
@ -473,7 +512,8 @@ public class KingPlace : NetworkBehaviour
|
|||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
private void SpawnHailServerRPC(Vector4 spawnLoc) {
|
||||
private void SpawnHailServerRPC(Vector4 spawnLoc)
|
||||
{
|
||||
placedObj = Instantiate(HailObject, Vector3.zero, Quaternion.identity);
|
||||
|
||||
placedObj.GetComponent<HailArea>().SetArea(spawnLoc.x, spawnLoc.y, spawnLoc.z, spawnLoc.w);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user