|
|
@@ -10,7 +10,7 @@ public class GameMgr : MonoBehaviour
|
|
|
public static bool debugInEditor = false;
|
|
|
public static int gameType = 0;
|
|
|
public GameMode gameMode;
|
|
|
- public bool gameOver = false;
|
|
|
+ [System.NonSerialized] public bool gameOver = false;
|
|
|
public static GameMgr ins;
|
|
|
|
|
|
void Awake()
|
|
|
@@ -179,7 +179,7 @@ public class GameModeTest : GameMode {
|
|
|
//记录可射击的靶子
|
|
|
if (SceneManager.GetActiveScene().name == "Game") {
|
|
|
TargetBody targetBody = GameObject.Find("GameArea/TargetObject/TargetBody").GetComponent<TargetBody>();
|
|
|
- GameObject.Find("Main Camera/ArmBow").GetComponent<ArmBow>().validTargets.Add(targetBody);
|
|
|
+ GameObject.FindObjectOfType<ArmBow>().validTargets.Add(targetBody);
|
|
|
}
|
|
|
}
|
|
|
public override void HitTarget(float score) {
|
|
|
@@ -201,7 +201,7 @@ public class TimeLimitGameMode : GameMode {
|
|
|
public TimeLimitGameMode(GameMgr gameMgr) : base(gameMgr) {
|
|
|
//记录可射击的靶子
|
|
|
targetBody = GameObject.Find("GameArea/TargetObject/TargetBody").GetComponent<TargetBody>();
|
|
|
- GameObject.Find("Main Camera/ArmBow").GetComponent<ArmBow>().validTargets.Add(targetBody);
|
|
|
+ GameObject.FindObjectOfType<ArmBow>().validTargets.Add(targetBody);
|
|
|
//添加游戏界面
|
|
|
GameObject view = Resources.Load<GameObject>("Prefabs/Views/TimeLimitGameView");
|
|
|
GameObject.Instantiate(view);
|
|
|
@@ -304,7 +304,7 @@ public class PKGameMode : GameMode {
|
|
|
currentPlayerIndex = appearPlayerIndexes.Dequeue();
|
|
|
//记录可射击的靶子
|
|
|
targetBody = GameObject.Find("GameArea/TargetObject/TargetBody").GetComponent<TargetBody>();
|
|
|
- GameObject.Find("Main Camera/ArmBow").GetComponent<ArmBow>().validTargets.Add(targetBody);
|
|
|
+ GameObject.FindObjectOfType<ArmBow>().validTargets.Add(targetBody);
|
|
|
targetBody.SetDistance(targetDistancesOnRound[round - 1]);
|
|
|
//添加游戏界面
|
|
|
GameObject view = Resources.Load<GameObject>("Prefabs/Views/PKGameView");
|