public void SubScore() { Score -= 10; if (Score < 0) { FirstSceneControllerBase.GetFirstSceneControllerBase().SetGameStatus(GameStatus.Lose); } }
public void AddScoreBonus() { if (CheckUpdate()) { Round++; FirstSceneControllerBase.GetFirstSceneControllerBase().Update(); } }
// Use this for initialization void Start() { GameObject plane = Instantiate(planePrefab); plane.transform.position = new Vector3(0f, 0f, 70f); gameStatus = GameStatus.Play; SceneStatus = SceneStatus.Waiting; uerInterface = FirstSceneControllerBase.GetFirstSceneControllerBase() as IUserInterface; queryStatus = FirstSceneControllerBase.GetFirstSceneControllerBase() as IQueryStatus; changeScore = FirstSceneControllerBase.GetFirstSceneControllerBase() as IScore; }
public void SendUFO(List <GameObject> usingUFOs) { inUseUFOs = usingUFOs; Reset(Round); for (int i = 0; i < usingUFOs.Count; i++) { usingUFOs[i].GetComponent <Renderer>().material.color = ufoModel.UFOColor; var startPos = ufoModel.startPos; usingUFOs[i].transform.position = startPos; FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Shooting); } }
public void AddScore() { if (count == 2 || count == 5) { Score += 20; } else { Score += 10; } if (CheckUpdate()) { Round++; FirstSceneControllerBase.GetFirstSceneControllerBase().Update(); } }
private void Update() { if (inUseUFOs != null) { for (int i = 0; i < inUseUFOs.Count; i++) { if (inUseUFOs[i].transform.position.y <= 1f) { FirstSceneControllerBase.GetFirstSceneControllerBase().DestroyUFO(inUseUFOs[i]); FirstSceneControllerBase.GetFirstSceneControllerBase().SubScore(); } } if (inUseUFOs.Count == 0) { FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Waiting); } } }
void OnGUI() { GUIStyle textStyle = new GUIStyle(); textStyle.fontSize = 40; if (totalTime >= 0) { GUI.Label(new Rect(x + 10, y - 100, -100, 100), "倒计时:" + (int)totalTime + "s", textStyle); } else if (totalTime >= -3) { GUI.Label(new Rect(x + 10, y - 100, -100, 100), "倒计时:0s", textStyle); } else if (totalTime < -3) { FirstSceneControllerBase.GetFirstSceneControllerBase().SetGameStatus(GameStatus.Lose); } totalTime -= Time.deltaTime; }
public void SendUFO(List <GameObject> usingUFOs) { inUseUFOs = usingUFOs; Reset(Round); for (int i = 0; i < usingUFOs.Count; i++) { usingUFOs[i].GetComponent <Renderer>().material.color = ufoModel.UFOColor; var startPos = ufoModel.startPos; usingUFOs[i].transform.position = new Vector3(startPos.x, startPos.y + i, startPos.z); Rigidbody rigibody; rigibody = usingUFOs[i].GetComponent <Rigidbody>(); rigibody.WakeUp(); rigibody.useGravity = true; rigibody.AddForce(ufoModel.startDirection * Random.Range(ufoModel.UFOSpeed * 5, ufoModel.UFOSpeed * 8) / 5, ForceMode.Impulse); FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Shooting); } }
private void Update() { if (inUseUFOs != null) { for (int i = 0; i < inUseUFOs.Count; i++) { if (inUseUFOs[i].transform.position == target) { FirstSceneControllerBase.GetFirstSceneControllerBase().DestroyUFO(inUseUFOs[i]); FirstSceneControllerBase.GetFirstSceneControllerBase().SubScore(); } else { inUseUFOs[i].transform.position = Vector3.MoveTowards(inUseUFOs[i].transform.position, target, 5 * Time.deltaTime); } } if (inUseUFOs.Count == 0) { FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Waiting); } } }
public void SendUFO(List <GameObject> usingUFOs) { inUseUFOs = usingUFOs; Reset(Round); Color UFOColor; for (int i = 0; i < usingUFOs.Count; i++) { int Ran = Random.Range(0, 3); if (Ran < 1) { UFOColor = Color.red; } else if (Ran < 2) { UFOColor = Color.blue; } else { UFOColor = Color.green; } usingUFOs [i].GetComponent <Renderer> ().material.color = UFOColor; float RanX = Random.Range(-5f, 5f); print(RanX); Vector3 startPos = new Vector3(RanX, 3f, -15f); Vector3 startDirection = new Vector3(-RanX, 8f, 3f); usingUFOs[i].transform.position = new Vector3(startPos.x, startPos.y + i, startPos.z); Rigidbody rigibody; rigibody = usingUFOs[i].GetComponent <Rigidbody>(); rigibody.WakeUp(); rigibody.useGravity = true; rigibody.AddForce(startDirection * Random.Range(ufoModel.UFOSpeed * 5, ufoModel.UFOSpeed * 8) / 5, ForceMode.Impulse); FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Shooting); } }
public void SendUFO(List <GameObject> usingUFOs) { inUseUFOs = usingUFOs; Reset(Round); Color UFOColor; for (int i = 0; i < usingUFOs.Count; i++) { int Ran = Random.Range(0, 3); if (Ran < 1) { UFOColor = Color.red; } else if (Ran < 2) { UFOColor = Color.blue; } else { UFOColor = Color.green; } usingUFOs [i].GetComponent <Renderer> ().material.color = UFOColor; Vector3 startPos; if (Round % 2 == 1) { startPos = new Vector3(5f, 3f, -15f); } else { startPos = new Vector3(-5f, 3f, -15f); } usingUFOs [i].transform.position = startPos; usingUFOs[i].transform.position = startPos; FirstSceneControllerBase.GetFirstSceneControllerBase().SetSceneStatus(SceneStatus.Shooting); } }
// Update is called once per frame void Update() { gameStatus = queryStatus.QueryGameStatus(); SceneStatus = queryStatus.QuerySceneStatus(); if (gameStatus == GameStatus.Play) { if (SceneStatus == SceneStatus.Waiting && Input.GetKeyDown("space")) { uerInterface.SendUFO(); FirstSceneControllerBase.GetFirstSceneControllerBase().Update(); } if (SceneStatus == SceneStatus.Shooting && Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit) && hit.collider.gameObject.tag == "UFO") { uerInterface.DestroyUFO(hit.collider.gameObject); changeScore.AddScore(); } } } }
// Use this for initialization void Start() { FirstSceneControllerBase.GetFirstSceneControllerBase().scene = gameObject.AddComponent <PhysicActionManager>(); }
// Use this for initialization void Start() { FirstSceneControllerBase.GetFirstSceneControllerBase().scene = gameObject.AddComponent <Scene>(); }