private void ChangeScene() { if (displayData.SceneList.Count > 0) { if (currentSceneSequenceID > displayData.SceneList.Count - 1) { currentSceneSequenceID = 0; } currentScene = displayData.SceneList[currentSceneSequenceID]; currentScene.setActive(); SceneManager.LoadScene(currentScene.sceneID); bgParticleManager.ActivateBackgroundParticle(currentScene.EffectID); currentSceneSequenceID++; //Load specific details about the scene configuration UpdateSceneTimer(); if (connectedRef2 != null) { connectedRef2.SetValueAsync(true); } if (currentSceneSequenceID > displayData.SceneList.Count - 1) { currentSceneSequenceID = 0; } } }
public virtual void swap(scene s) { Debug.WriteLine(this + "::swap"); Debug.WriteLine(" scene = " + s); pop(); push(s); }
public void MiddleManager(int changeScene) { currentScene = currentScene + changeScene; switch (currentScene) { case scene.Body: first.SetActive(true); second.SetActive(false); //third.SetActive(false); spotLight.color = Color.white; break; case scene.CarNoHood: spotLight.color = Color.red; first.SetActive(false); second.SetActive(true); break; case scene.CarHood: spotLight.color = Color.white; first.SetActive(false); second.SetActive(true); break; } }
private void ShowQRImage() { string str = "bind" + DateTime.Now.ToString("yyyyMMddHHmmss"); try { QrcodeInfo info2 = new QrcodeInfo { codeType = "TEMP", showLogo = "Y", expireSecond = 600 }; codeInfo info3 = new codeInfo(); scene scene = new scene { sceneId = str }; info3.scene = scene; info2.codeInfo = info3; QrcodeInfo codeInfo = info2; this.hiddSceneId.Value = str; AlipayMobilePublicQrcodeCreateResponse response = AliOHHelper.QrcodeSend(codeInfo); if ((response != null) && (response.Code == 200L)) { this.imgQRCode.ImageUrl = response.CodeImg; } else { this.imgQRCode.AlternateText = "未成功获取服务窗授权"; } } catch (Exception exception) { AliOHHelper.log(exception.Message); } }
public WoodcuttingHandler(Vector2 position) { player = Main.game.player; chatbox = Main.game.chat; Level = Main.game.scen; Tree_Position = position; Tree_Area = new Rectangle((int)position.X, (int)position.Y, 80, 80); }
void loadGame() { clearMap(); //讀取json檔案 TextAsset json = Resources.Load("scene/s998") as TextAsset; scene scene = new scene(); scene = JsonUtility.FromJson <scene>(json.text); //產生場景 GameObject Cubes = GameObject.Find("Cubes"); for (var i = 0; i < scene.cubeArray.Count; i += 5) { Vector3 tempVector3 = new Vector3(scene.cubeArray[i], scene.cubeArray[i + 1], scene.cubeArray[i + 2]); string name = tempVector3.ToString("F0"); //檢查是否已經存在於unity scene中 // if (GameObject.Find (name)) // { // string meshname = GameObject.Find (name).GetComponent<MeshFilter>().sharedMesh.name; // if (meshname == scene.cubeArray [i + 3].ToString ("F0")) // { // Debug.Log ("break"); // break; // } // } //新增CUBE GameObject temp = Instantiate(GameObject.Find("Cube")); //todo:Cube可以不需要用Find的方式 temp.transform.parent = Cubes.transform; temp.transform.position = tempVector3; temp.name = name; temp.GetComponent <MeshRenderer>().receiveShadows = true; temp.GetComponent <Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; temp.GetComponent <Renderer>().enabled = true; Mesh mesh = (Mesh)Resources.Load("item/model/CUBE/" + scene.cubeArray[i + 3], typeof(Mesh)); temp.GetComponent <Renderer>().sharedMaterial.mainTexture.filterMode = FilterMode.Point; temp.GetComponent <MeshFilter>().mesh = mesh; switch (Mathf.FloorToInt(scene.cubeArray[i + 4])) { case 0: temp.tag = "Cube"; //建立目錄cubesDictionary cubesDictionary[new Vector3(tempVector3.x, tempVector3.y, tempVector3.z)] = new Vector2(float.Parse(mesh.name), 0); break; case 1: temp.tag = "Cube_WalkSMP"; cubesDictionary[new Vector3(tempVector3.x, tempVector3.y, tempVector3.z)] = new Vector2(float.Parse(mesh.name), 1); break; } } // Cubes.AddComponent<DCM.DrawCallMinimizer>(); GameObject.Find("aStart").AddComponent <Pathfinding>(); PathfindingCS = GameObject.Find("aStart").GetComponent <Pathfinding>(); }
public IEnumerator fadeToLoadScene(scene scene) { levelFader.SetActive(true); yield return(FadingUtils.fadeImage(levelFader.GetComponent <Image>(), 1f, 0f, 1f)); string sceneName = getLevelName(scene); UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName); }
public void Chopped_Tree() { Cutting_Tree = false; Dead_Tree = true; Tree_Fall_Timer = time; Level = Main.game.scen; Level.Replace_Texture(Tree_Position + new Vector2(0, 0), 1, 0); Level.Replace_Texture(Tree_Position + new Vector2(0, 32), 1, 0); Level.Replace_Texture(Tree_Position + new Vector2(32, 0), 1, 0); Level.Replace_Texture(Tree_Position + new Vector2(32, 32), 55, 0); Console.WriteLine("[Game] Tree falls down. \n Initializing respawn timer."); }
public virtual void push(scene s) { Debug.WriteLine(this + "::push"); Debug.WriteLine(" scene = " + s); if (scenes.Count > 0) scenes.Peek().suspend(); s.Initialize(); scenes.Push(s); }
/// <summary> /// Получаем сцену по id /// </summary> /// <param name="id">Id сцены</param> /// <returns>Найденная сцена, либо null</returns> public scene getSceneById(long id) { scene ex = null; try { //Возвращаем сцену по id ex = scenes.FirstOrDefault(sc => (sc.id == id)); } catch { ex = null; } return(ex); }
public Portal(scene map) { Portals[0] = new Rectangle(0, 544, 896, 32); Portals[1] = new Rectangle(0, 0, 896, 32); Portals[2] = new Rectangle(0, 0, 32, 896); Portals[3] = new Rectangle(864, 0, 32, 896); Portals[4] = new Rectangle(0, 544, 896, 32); level = map; player = Main.game.player; }
private void PauseLoop() { pauseLoop = true; Scene tmpscene = SceneManager.GetActiveScene(); if (tmpscene.buildIndex != displayData.lockedScene) { currentScene = new scene(); currentScene.setActive(); currentScene.sceneID = displayData.lockedScene; SceneManager.LoadScene(displayData.lockedScene); updateMatchMadness = true; } }
IEnumerator loadscene() { while (!pauseLoop) { currentScene = displayInfo.scenes[currentSceneSequenceID]; Application.LoadLevel(currentScene.sceneID); yield return(new WaitForSeconds(currentScene.duration)); currentSceneSequenceID++; //Debug.Log("current Scene Sequence ID:" + currentSceneSequenceID); if (currentSceneSequenceID > displayInfo.scenes.Count() - 1) { currentSceneSequenceID = 0; } } }
/*=======================================-Stores Objects related to game state-=============================================*/ /*=======================================+Sets up game scenes+=============================================*/ private void makeStory() { elementManager.allScenes.Add( "Master's Room", new scene( "You enter a drab room. On an old dusty crate sits" + " an old man wearing a mangy robe which drapes off his " + "arms, highlighting the fact that this man doesn't have any hands" + ". This is the man you know to be The Master. What do you do?", "is a swirling portal.")); elementManager.allScenes.Add( "Glowing Pool", new scene( "You enter into a large cavern with crystalline walls." + " The faintest gleam of light manages to shimmer through the tarnished crystal surfaces. " + "A large pillar rises from the centre of the room, on top of which sits a smiling imp. " + "A pool of glowing liquid shimmers ominously to the west. What do you do?", "a glass surface covered in strange mist")); elementManager.allScenes.Add( "Empty", new scene("You should not be here", "The world stretches infinitely in this direction." )); elementManager.allScenes.Add( "Stone Guard", new scene( "No! Banned!", "a Stone Guard stands.")); elementManager.allScenes["Stone Guard"].SceneType = "obstacle"; elementManager.allScenes["Master's Room"].North = "Glowing Pool"; elementManager.allScenes["Glowing Pool"].South = "Stone Guard"; elementManager.allScenes["Stone Guard"].South = "Master's Room"; // firstScene = "Masters Room"; //firstScene = new Area("You enter a drab room. A mirror full of swelling energy sits at your back.On an old dusty crate sits an old man wearing a mangy rob which draps ofhis arm highlighting the fact that this man doesn't have any hands. This is the man you know to be The Master.What do you do? "); //firstScene.North = "Glowing Pool"; //firstScene.North.South = firstScene; currentScene = elementManager.allScenes[sceneCode]; }
static void SaveJson() { scene scene = new scene(); //儲存tag ==Cube GameObject[] respawnsCube; respawnsCube = GameObject.FindGameObjectsWithTag("Cube"); foreach (GameObject respawn in respawnsCube) { scene.cubeArray.Add(respawn.transform.position.x); scene.cubeArray.Add(respawn.transform.position.y); scene.cubeArray.Add(respawn.transform.position.z); string name = respawn.GetComponent <MeshFilter>().sharedMesh.name; scene.cubeArray.Add(float.Parse(name)); scene.cubeArray.Add(0); } //儲存tag ==Cube_WalkSMP GameObject[] respawnsSMP; respawnsSMP = GameObject.FindGameObjectsWithTag("Cube_WalkSMP"); foreach (GameObject respawn in respawnsSMP) { scene.cubeArray.Add(respawn.transform.position.x); scene.cubeArray.Add(respawn.transform.position.y); scene.cubeArray.Add(respawn.transform.position.z); string name = respawn.GetComponent <MeshFilter>().sharedMesh.name; scene.cubeArray.Add(float.Parse(name)); scene.cubeArray.Add(1); } //儲存長度 //雖然非必要,但便於觀看場景資訊 scene.length = scene.cubeArray.Count; //儲存角色位置 //todo:角色名稱不一定是Cha_Kinight scene.playerPos = GameObject.Find("Cha_Knight").transform.position; //將Object轉存為json,並存檔 string json = JsonUtility.ToJson(scene); StreamWriter file = new StreamWriter(Application.dataPath + "/Resources/scene/s998.json"); file.Write(json); file.Close(); UnityEditor.EditorUtility.DisplayDialog("Save End ", " --=== Save End ===--", "[OK]"); }
private void loadPreviousScene() { if (displayData.SceneList.Count > 0) { currentScene = displayData.SceneList[currentSceneSequenceID]; SceneManager.LoadScene(currentScene.sceneID); bgParticleManager.ActivateBackgroundParticle(currentScene.EffectID); currentSceneSequenceID++; //Load specific details about the scene configuration UpdateSceneTimer(); if (currentSceneSequenceID > displayData.SceneList.Count - 1) { currentSceneSequenceID = 0; } } }
static void clearMap() { //讀取json檔案 TextAsset json = Resources.Load("scene/s998") as TextAsset; scene scene = new scene(); scene = JsonUtility.FromJson <scene>(json.text); for (var i = 0; i < scene.cubeArray.Count; i += 5) { Vector3 temp; temp.x = scene.cubeArray[i]; temp.y = scene.cubeArray[i + 1]; temp.z = scene.cubeArray[i + 2]; DestroyImmediate(GameObject.Find(temp.ToString("F1"))); } }
private void UpdateCurrentSceneData() { if (currentScene != null && displayData.SceneList != null && currentScene.sceneID != 0) { scene foundScene = displayData.SceneList.Find(s => s.promoID.Equals(currentScene.promoID)); if (foundScene != null) { if (foundScene.lastUpdated != currentScene.lastUpdated || foundScene.promotionStatus != currentScene.promotionStatus) { currentScene = foundScene; currentScene.setActive(); updateSceneDataNow = true; UpdateSceneTimer(); saveSettingsFile(); } } } }
public ActionResult CreateForeverQR() { WechatIDQRInfo IdQR = new WechatIDQRInfo(); IdQR.action_name = "QR_SCENE"; action_info action = new action_info(); IdQR.action_info = action; scene scene = new scene(); scene.scene_str = "stringqr"; string postData = JsonConvert.SerializeObject(IdQR); string token = AccessTokenService.GetAccessToken(); string result = WechatQRServices.CreateForeverQR(token, postData); ViewBag.result = result; return(View("Result")); }
static void LoadJson() { //讀取json檔案 TextAsset json = Resources.Load("scene/s998") as TextAsset; scene scene = new scene(); scene = JsonUtility.FromJson <scene>(json.text); //產生場景 GameObject Cubes = GameObject.Find("Cubes"); for (var i = 0; i < scene.cubeArray.Count; i += 5) { GameObject temp = Instantiate(GameObject.Find("Cube"));//todo:Cube可以不需要用Find的方式 Vector3 tempVector3 = new Vector3(scene.cubeArray[i], scene.cubeArray[i + 1], scene.cubeArray[i + 2]); temp.transform.parent = Cubes.transform; temp.transform.position = tempVector3; temp.name = temp.transform.position.ToString("F1"); temp.GetComponent <MeshRenderer>().receiveShadows = true; temp.GetComponent <Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; temp.GetComponent <Renderer>().enabled = true; Mesh mesh = (Mesh)Resources.Load("item/model/CUBE/" + scene.cubeArray[i + 3], typeof(Mesh)); temp.GetComponent <MeshFilter>().mesh = mesh; temp.GetComponent <Renderer>().sharedMaterial.mainTexture.filterMode = FilterMode.Point; switch (Mathf.FloorToInt(scene.cubeArray[i + 4])) { case 0: temp.tag = "Cube"; break; case 1: temp.tag = "Cube_WalkSMP"; break; } } }
private static string getLevelName(scene scene) { if (scene == scene.FIGHTING_LEVEL) { return(FIGHTING_LEVEL); } else if (scene == scene.TOWN_LEVEL) { return(TOWN_LEVEL); } else if (scene == scene.WALKING_LEVEL) { return(WALKING_LEVEL); } else if (scene == scene.CAMPSITE) { return(CAMPSITE); } else { throw new System.Exception("Tried to load non-existent scene"); } }
public int baziliskChance() { if (nowCoin <= 2) { okane -= 1000; nowCoin += 50; } nowCoin -= inputcoin; Debug.Log(c + "回転(BC)"); switch (DrawLot(rare_probability)) { case 0: Debug.Log("押し順"); payout = 8; bc_osijun++; break; case 1: Debug.Log("リプレイ"); payout = 3; break; case 2: Debug.Log("弱チェ"); payout = 2; break; case 3: Debug.Log("巻物"); payout = 3; break; case 4: Debug.Log("共通ベル"); payout = 8; break; case 5: Debug.Log("強チェリー"); payout = 2; break; case 6: Debug.Log("チャンス目"); payout = 1; break; case 7: Debug.Log("プレミアムリプレイ"); payout = 3; break; default: Debug.Log("外れ"); payout = 0; break; } nowCoin += payout; totalpay += payout - inputcoin; if (bc_osijun > 8) { s = scene.tujo; } return(0); }
public static void loadScene(scene scene) { _instance.StartCoroutine(_instance.fadeToLoadScene(scene)); Player.instance.savePlayer(); }
// Use this for initialization void Start() { spotLight = GetComponentInChildren <Light>(); currentScene = scene.Body; MiddleManager(0); }
public override void perform(string[] pSplitCommand) { Debug.Log("Opening" + adverb + " menu"); splitCommand = pSplitCommand; scene _Scene = GameManager.instance.gameModel.currentScene; }
public override void perform(string[] pSplitCommand) { /* +Loads required varables+ */ Debug.Log("Attacking" + adverb); splitCommand = pSplitCommand; scene lcScene = GameManager.instance.gameModel.currentScene; //Gains a copy of the current scene for local use /* -Loads required varables- */ /* * * Switch statement for the four game directions. * The game loads the current scene. * The game wont proceed if the target scene is an Empty scene and an obstacle. * Removes the obstacle from between the current scene and the next screen. * */ switch (adverb) { /* +Code for attack north+ */ case "north": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.North != "Empty") { if (lcScene.SceneType == "obstacle") { GameManager.instance.gameModel.currentScene.North = elementManager.allScenes[lcScene.North].North; } } break; /* -Code for attack north- */ /* +Code for attack south+ */ case "south": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.South != "Empty") { if (lcScene.SceneType == "obstacle") { GameManager.instance.gameModel.currentScene.South = elementManager.allScenes[lcScene.South].South; } } break; /* -Code for attack south- */ /* +Code for attack west+ */ case "west": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.West != "Empty") { if (lcScene.SceneType == "obstacle") { GameManager.instance.gameModel.currentScene.West = elementManager.allScenes[lcScene.West].West; } } break; /* -Code for attack west- */ /* +Code for attack east+ */ case "east": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.East != "Empty") { if (lcScene.SceneType == "obstacle") { GameManager.instance.gameModel.currentScene.East = elementManager.allScenes[lcScene.East].East; } } break; /* -Code for attack east- */ } }
public override void perform(string[] pSplitCommand) { /* +Loads required varables+ */ Debug.Log("Moving" + adverb); splitCommand = pSplitCommand; scene lcScene = GameManager.instance.gameModel.currentScene; /* -Loads required varables- */ /* * * Switch statement for the four game directions. * The game loads the current scene. * The game wont proceed if the target scene is an Empty scene and an area. * Changes currentScene to the approprate scene. * */ switch (adverb) { /* +Code for move north+ */ case "north": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.North != "Empty") { if (lcScene.SceneType == "area") { GameManager.instance.gameModel.currentScene = elementManager.allScenes[lcScene.North]; } } break; /* -Code for move north- */ /* +Code for move south+ */ case "south": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.South != "Empty") { if (lcScene.SceneType == "area") { GameManager.instance.gameModel.currentScene = elementManager.allScenes[lcScene.South]; } } break; /* -Code for move south- */ /* +Code for move west+ */ case "west": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.West != "Empty") { if (lcScene.SceneType == "area") { GameManager.instance.gameModel.currentScene = elementManager.allScenes[lcScene.West]; } } break; /* -Code for move west- */ /* +Code for move east+ */ case "east": lcScene = GameManager.instance.gameModel.currentScene; if (lcScene.East != "Empty") { if (lcScene.SceneType == "area") { GameManager.instance.gameModel.currentScene = elementManager.allScenes[lcScene.East]; } } break; /* -Code for move east- */ } }
void Update(){ //ゲーム状態遷移 switch (this.gameScene) { //OPアニメーション処理(実処理はスクリプト「test100.cs」にて処理) case scene.START_ANIMATION: //各シーン終了フラグ&外部テキストファイル読込完了フラグ双方がtureならば次シーンへ移行 if(this.finFlag && this.loaded){ GameObject.Find("Score").transform.FindChild("Num").GetComponent<GUIText>().text = "100"; //読み込んだ外部テキストファイルから各キャラのステータスを摘出 ExtractStatus("tesd1"); ExtractStatus("tesd2"); ExtractStatus("tesd3"); ExtractStatus("tesd4"); ExtractStatus("tesd5"); //”フレンドキャラ”のステータスはランダム(ATK:100~500 スタミナ:2~5)で決定 GameObject.Find("Friend").GetComponent<Mouse>().GetATK = Random.Range(10,1000); GameObject.Find("Friend").GetComponent<Mouse>().GetStamina = Random.Range(2,5); GameObject.Find ("Scene").transform.Find ("SelectMember").gameObject.SetActive (true); //次シーンをアクティブに gameScene = scene.SELECT_MEMBER_NUM; //次シーンに移行 this.finFlag = false; //シーン終了フラグをfalseに戻す } break; //レース参加人数選択処理(実処理はスクリプト「SelectMember.cs」「ButtonMember.cs」にて処理) case scene.SELECT_MEMBER_NUM: //レース参加人数選択のボタンが押され,「ButtonMember -> SelectMember -> GameMain」経由で「参加人数」を取得すれば次シーンへ移行 if(this.memberNumber != -1){ GameObject.Find ("Scene").transform.FindChild("SelectMember").gameObject.SetActive (false); //次シーンをアクティブに GameObject.Find("SetMember").transform.FindChild("Explanation").gameObject.SetActive(true); //各キャラのオブジェに設けられたMouseFlagをtrueに try{ GameObject.Find ("tesd1").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd2").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd3").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd4").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd5").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("Friend").GetComponent<Mouse>().MouseFlag=true; }catch{} GameObject.Find("SetMember").transform.FindChild("SetPosition").gameObject.SetActive(true); //GameObject.Find("SetPosition").transform.FindChild("Set2").gameObject.SetActive(false); gameScene = scene.SELECT_CHARA; //次シーンへ移行 } break; //レースに参加するキャラを選択(次処理はスクリプト「Mouse.cs」「test.cs」) case scene.SELECT_CHARA: if(this.finFlag){ try{ GameObject.Find ("tesd1").GetComponent<Mouse>().MouseFlag=false; }catch{} try{ GameObject.Find ("tesd2").GetComponent<Mouse>().MouseFlag=false; }catch{} try{ GameObject.Find ("tesd3").GetComponent<Mouse>().MouseFlag=false; }catch{} try{ GameObject.Find ("tesd4").GetComponent<Mouse>().MouseFlag=false; }catch{} try{ GameObject.Find ("tesd5").GetComponent<Mouse>().MouseFlag=false; }catch{} try{ GameObject.Find ("Friend").GetComponent<Mouse>().MouseFlag=false; }catch{} gameScene = scene.RACE; this.finFlag = false; GameObject.Find ("Scene").transform.FindChild("Race").gameObject.SetActive(true); transform.FindChild("Score").gameObject.SetActive(true); } break; //レース処理(実処理はスクリプト「Race.cs」) case scene.RACE: if(finFlag){ gameScene = scene.GOAL; GameObject.Find("Scene").transform.FindChild("Goal").gameObject.SetActive(true); } break; case scene.GOAL: if(finFlag){ //Instantiate(prefab); //prefab.GetComponent<SaveNum>().SaveNumber = GameObject.Find("Race").GetComponent<Race>().GetRanking; num = GameObject.Find("Race").GetComponent<Race>().GetRanking; GameObject.Find("SaveNum").GetComponent<SaveNum>().SaveNumber = num; CameraFade.StartAlphaFade (Color.black, false, 2f, 3f, () => { Application.LoadLevel ("end"); }); gameScene = scene.END; } break; case scene.END: break; } }
//Race.csからアクセス シーンをSELECT_CHARAへと移行 public void GameScene(){ this.gameScene = scene.SELECT_CHARA; }
public int tujo() { if (nowCoin <= 2) { okane -= 1000; nowCoin += 50; } nowCoin -= inputcoin; Debug.Log(c + "回転(通常)"); switch (DrawLot(rare_probability)) { case 0: Debug.Log("押し順"); payout = 0; break; case 1: Debug.Log("リプレイ"); payout = 3; break; case 2: Debug.Log("弱チェ"); payout = 2; break; case 3: Debug.Log("巻物"); payout = 3; if (GetRandomIndex(_BCmakimono) == 0) { Debug.Log("BC当選"); s = scene.bc; } break; case 4: Debug.Log("共通ベル"); payout = 8; break; case 5: Debug.Log("強チェリー"); payout = 2; break; case 6: Debug.Log("チャンス目"); payout = 1; break; case 7: Debug.Log("プレミアムリプレイ"); payout = 3; break; default: Debug.Log("外れ"); payout = 0; break; } nowCoin += payout; totalpay += payout - inputcoin; return(0); }
public void EnterScene(scene.SceneType sceneType, object arg = null)//map.Map map = null) { _prevSceneType = _currentScene.SceneType; scene.Scene s = null; if (sceneType == SceneType.GameStage) { map.Map map = null; if (arg != null) map = arg as map.Map; if (_prevMap != null && _prevMap != map) _prevMap.Dispose(); _prevMap = map; s = CreateScene(sceneType, this, map); } else if (sceneType == SceneType.Error) { s = CreateScene(sceneType, this, (string[])arg); } else { s = CreateScene(sceneType, this, null); } if (s != null) _currentScene = s; }
void Update () { GameObject.Find("Score").transform.FindChild ("Num").GetComponent<GUIText> ().text = ranking.ToString(); switch (raceScene) { //追い越し人数算出処理 case scene.CALCULATION : switch(currentTurn){ case 1: Forerun = (int)(this.setMember1.GetComponent<Mouse>().GetATK * 0.1f); break; case 2: Forerun = (int)(this.setMember2.GetComponent<Mouse>().GetATK * 0.1f); break; case 3: Forerun = (int)(this.setMember2.GetComponent<Mouse>().GetATK * 0.1f); break; } /* if(currentTurn > 1){ Forerun = (int)(this.setMember2.GetComponent<Mouse>().GetATK * 0.1f); }else{ Forerun = (int)(this.setMember1.GetComponent<Mouse>().GetATK * 0.1f); } */ raceScene = scene.ANIMATION; //シーン状態をANIMATIONに移行 this.time = Time.realtimeSinceStartup; //1アニメーション開始時刻を取得 BGanim.scrollSpeed = 0.7f; //BGのスクロール速度を0.3 -> 0.7 break; //追い越しアニメーション処理 case scene.ANIMATION: this.currentTime = Time.realtimeSinceStartup; //現在時刻を習得 //timeとcurrentTimeの差分が0.1s で敵キャラ1機を流す(右から左へ流す) if(this.currentTime - this.time >= 0.07f){ //追い越し予定数と同値まで追い越したらレース状態をANIMATION -> NEXTへ移行 if(this.Forerun <= this.token || ranking == 1){ raceScene = scene.NEXT; //シーンをNEXTへ移行 this.currentTurn--; //追い越し処理,未処理回数をデクリメント StartCoroutine("WaitNext"); //WaitNextコルーチンを始動 this.token = 0; //追い越した数カウンターをゼロリセット BGanim.scrollSpeed = 0.3f; //BGのスクロール速度を0.7 -> 0.3へ戻す break; } //流れる敵キャラオブジェのクローン生成 Instantiate(enemy,new Vector3(17,Random.Range(-8,8),-1), Quaternion.Euler(0, -90, 90)); this.time = this.currentTime; this.token++; if(ranking > 1) { ranking--; } } break; //「追い越し」の後処理 次の動作を判定(「追い越し」未処理回数によって分岐) case scene.NEXT : switch(currentTurn){ case 0 : GameObject.Find("GameMain").GetComponent<GameMain>().FinFlag = true; //GameMainでのシーン終了フラグをtrueへ break; //コルーチンWaitNextにてwaitFlagがfalseにされればCALCUCATIONへシーン移行 case 1 : if(!this.waitFlag){ raceScene = scene.CALCULATION; } break; //各オブジェのマウスロックフラグをtrueに default : try{ GameObject.Find ("tesd1").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd2").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd3").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd4").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("tesd5").GetComponent<Mouse>().MouseFlag=true; }catch{} try{ GameObject.Find ("Friend").GetComponent<Mouse>().MouseFlag=true; }catch{} setMember2.SetActive(false); //セットポジションに設置されたキャラオブジェをパッシブに raceScene = scene.CALCULATION; //CALCULATIONへシーン移行 GameObject.Find ("GameMain").GetComponent<GameMain>().GameScene(); //GameMainのシーンをSELECT_CHARAへ移行 GameObject.Find("SetMember").transform.FindChild("Explanation").gameObject.SetActive(true); GameObject.Find("Explanation").transform.FindChild("Supporter").gameObject.SetActive(true); gameObject.SetActive(false); //一旦Raceオブジェをパッシブに break; } break; } }
static void Main(string[] args) //All methods are called here, as well as some of the logic that only needs to happen once { SoundPlayer backgroundMusic = new SoundPlayer(); //plays background music backgroundMusic.SoundLocation = AppDomain.CurrentDomain.BaseDirectory + "\\theme.wav"; backgroundMusic.PlayLooping(); Console.ForegroundColor = ConsoleColor.Green; beginning: scene scene = new scene(); //object to call scene methods method method = new method(); //object to call logic methods bool weaponObtained = false; //string to keep track of whether the use found a weapon scene.one(); //displays the welcome screen method.input(); //checks for user input (this is used a ton) switch (method.selectedOption) //this switch case checks what option the user selected { case "X": //displays info screen { Console.Clear(); scene.two(); method.input(); if (method.selectedOption == "Z") { Console.Clear(); goto beginning; } break; } case "Z": //starts game { Console.Clear(); goto startgame; } case "Escape": //exits to windows { Environment.Exit(0); break; } } startgame: Console.Clear(); scene.four(); //launches the first part of the game method.input(); switch (method.selectedOption) { case "Z": //user decides to explore vault { Console.Clear(); scene.five(); method.input(); if (method.selectedOption == "Z") //user gets some info about the vault { method.random(); if (method.randomOutput > 2) //decides whether to give the user a weapon based on random number generation { Console.Clear(); scene.seven(); weaponObtained = true; method.input(); if (method.selectedOption == "Z") { Console.Clear(); goto outside; } } else //forces the user to go outside of the vault regardless of whether they found a weapon { Console.Clear(); scene.eight(); method.input(); if (method.selectedOption == "Z") { goto outside; } } } break; } case "X": //takes the user outside of the vault since they didn't explore { Console.Clear(); goto outside; } case "Escape": //takes the user back to the main menu { Console.Clear(); goto beginning; } } outside: Console.Clear(); scene.nine(); //user exits the vault, and hears a noise coming from his old neighborhood. user has to decide whether to investigate method.input(); switch (method.selectedOption) { case "Z": //user decides not to investigate { Console.Clear(); scene.ten(); method.input(); if (method.selectedOption == "X") //user dies and has to start from beginning { Console.Clear(); scene.eleven(); method.input(); if (method.selectedOption == "Escape") { Console.Clear(); goto beginning; } } break; } case "X": { goto walktonoise; //user decides to investigate } } walktonoise: Console.Clear(); scene.twelve(); method.input(); switch (method.selectedOption) //user discovers raiders { case "Z": //tries to befriend raiders { Console.Clear(); scene.thirteen(); method.input(); if (method.selectedOption == "ESC") //dies { Console.Clear(); goto beginning; } break; } case "X": //sneaks up on raiders { Console.Clear(); goto killraiders; //jumps to killing raiders } } killraiders: if (weaponObtained == true) //checks if you got the weapon { method.random(); if (method.randomOutput > 2) //random number generator for odds of killing raiders { Console.Clear(); scene.fourteen(); method.input(); if (method.selectedOption == "Z") //gonna shoot the weapon { Console.Clear(); scene.sixteen(); method.input(); if (method.selectedOption == "Z") //kill the raiders { Console.Clear(); scene.eighteen(); //read note method.input(); if (method.selectedOption == "Escape") //go back to main screen { Console.Clear(); goto beginning; } } } } else { Console.Clear(); scene.fourteen(); //doesnt kill raiders method.input(); if (method.selectedOption == "Z") { Console.Clear(); scene.seventeen(); method.input(); if (method.selectedOption == "Escape") //dies { Console.Clear(); scene.one(); goto beginning; //back to main screen } } } } else { method.random(); if (method.randomOutput > 4) //user didn't find weapon, lowers odds of killing raiders { Console.Clear(); scene.fifteen(); method.input(); if (method.selectedOption == "Z") //kill raiders { Console.Clear(); scene.sixteen(); method.input(); if (method.selectedOption == "Z") //throw rock { Console.Clear(); scene.eighteen(); method.input(); if (method.selectedOption == "Escape") //finish game { Console.Clear(); goto beginning; } } } } else { Console.Clear(); scene.fifteen(); method.input(); if (method.selectedOption == "Z") //throw rock { if (method.selectedOption == "Escape") //die { Console.Clear(); goto beginning; } } } } }