mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Fixed King Null Ref Errors
- Fixed KingPlace and KingMove Null Refs - Changed the Networked Slime to isTrigger instead of solid
This commit is contained in:
@@ -11,7 +11,9 @@ public class Goo : MonoBehaviour
|
||||
void FixedUpdate() {
|
||||
Lifetime++;
|
||||
if(Lifetime == 850) {
|
||||
DespawnMyselfServerRPC();
|
||||
if (NetworkManager.Singleton.IsServer) {
|
||||
DespawnMyselfServerRPC();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ public class GridReveal : MonoBehaviour
|
||||
for (int i = Rows.Length-1; i > ROSCount-1; i--) {// Disables most of the Rows that the King can't see
|
||||
Rows[i].SetActive(false);
|
||||
}
|
||||
ToggleMountainGrid(true);
|
||||
}
|
||||
|
||||
public void ToggleMountainGrid(bool state) {
|
||||
Rows[Rows.Length - 2].SetActive(state);
|
||||
}
|
||||
|
||||
public void GridSwitch(bool State) {//Activates or deactivates the Grid
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using MLAPI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class KingMove : NetworkBehaviour
|
||||
{
|
||||
@@ -20,10 +21,12 @@ public class KingMove : NetworkBehaviour
|
||||
transform.position = KingStrPos;
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
void Start() {
|
||||
// Turn on the king grid after a couple seconds. Allows scripts to grab their reference to it before it is disabled
|
||||
StartCoroutine(TurnOffGridAtStartOfMatch());
|
||||
// Only try to grab references if we are actually in the game scene
|
||||
if (SceneManager.GetActiveScene().buildIndex == 3) {
|
||||
StartCoroutine(TurnOffGridAtStartOfMatch());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator TurnOffGridAtStartOfMatch()
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using MLAPI;
|
||||
using MLAPI.Messaging;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class KingPlace : NetworkBehaviour
|
||||
{
|
||||
@@ -54,10 +56,19 @@ public class KingPlace : NetworkBehaviour
|
||||
|
||||
private GameObject placedObj;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Grid = GameObject.FindGameObjectWithTag("KingGrid");
|
||||
MountGrid = Grid.transform.Find("MountainGrid").gameObject;
|
||||
void Start() {
|
||||
// Only try to grab references if we are actually in the game scene
|
||||
if (SceneManager.GetActiveScene().buildIndex == 3) {
|
||||
Grid = GameObject.FindGameObjectWithTag("KingGrid");
|
||||
MountGrid = GameObject.FindGameObjectWithTag("MountainGrid");
|
||||
try
|
||||
{
|
||||
Grid.GetComponent<GridReveal>().ToggleMountainGrid(false);
|
||||
} catch(NullReferenceException e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Avaliable;
|
||||
|
||||
Reference in New Issue
Block a user