// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.step = STEP.NONE; this.next_step = STEP.WAIT; GlobalParam.getInstance().fadein_start = true; if(!TitleControl.is_single) { #if true this.m_serverAddress = ""; // 호스트 이름을 얻는다. string hostname = Dns.GetHostName(); // 호스트 이름에서 IP주소를 얻는다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); m_serverAddress = adrList[0].ToString(); #endif GameObject obj = GameObject.Find("Network"); if (obj == null) { obj = new GameObject ("Network"); } if (m_network == null) { m_network = obj.AddComponent<Network>(); if (m_network != null) { DontDestroyOnLoad(m_network); } } } }
void Update() { this.step_timer += Time.deltaTime; // 상태 변화 대기 -----. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: // 클리어 조건을 만족하면. if(this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; // 클리어 상태로 이행. } break; } } // 상태가 변화했다면 ------. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.CLEAR: // block_root를 정지. this.block_root.enabled = false; // 경과 시간을 클리어 시간으로 설정. this.clear_time = this.step_timer; break; } this.step_timer = 0.0f; } }
void Start() { this.unito_motion = this.transform.GetComponentInChildren<Animation>(); //motion. this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); this.effect_control = GameObject.Find("GameRoot").gameObject.GetComponent<VanishEffectControl>(); this.count_repair_eff = REPAIR_EFF_TIMING; this.count_repair_se = REPAIR_SE_TIMING; next_step = STEP.IDLE; // --------------------------------------------. // 가끔 머리에 꽃을!. int rnd = Random.Range(0, 9); if(rnd > 5){ GameObject go = GameObject.Instantiate(this.hana_prefab) as GameObject; go.transform.parent = unitoAtama; go.transform.position = unitoAtama.position; go.transform.localScale = Vector3.one; } // --------------------------------------------. // 2014.06.16. // 서서히 완성판 구현도 막바지에 이르렀다. // 원고 수정도 끝나고 표지도 정해졌다. // 발매일이 가까워지면서 조금은 두근두근 거리는 시간을 보내는 중. // 이 책을 사주셔서 정말 기쁘고 뭔가 하나라도 얻는 게 있으면 좋겠다. // --------------------------------------------. }
void Start() { this.unito_motion = this.transform.GetComponentInChildren<Animation>(); //motion. this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); this.effect_control = GameObject.Find("GameRoot").gameObject.GetComponent<VanishEffectControl>(); this.count_repair_eff = REPAIR_EFF_TIMING; this.count_repair_se = REPAIR_SE_TIMING; next_step = STEP.IDLE; // --------------------------------------------. // たまーに頭の上に花が咲く!. int rnd = Random.Range(0, 9); if(rnd > 5){ GameObject go = GameObject.Instantiate(this.hana_prefab) as GameObject; go.transform.parent = unitoAtama; go.transform.position = unitoAtama.position; go.transform.localScale = Vector3.one; } // --------------------------------------------. // 2014.06.16. // そろそろ完成版の実装も終わりに近づいてきた. // 原稿の修正も終わり,カバーも決まり. // 発売日が近づいてくる中,ちょっとどきどきしながら時を過ごしています. // この本を買ってもらえた事は本当に嬉しく,何か1つでも得るものがあると幸いです. // --------------------------------------------. }
private void btnCheckBef_Click(object sender, EventArgs e) { preStep = STEP.OPENLINK; string html = wbAddmefast.DocumentText; Match match = Regex.Match(html, @"confirmSingleFB\((.*?)\);", RegexOptions.IgnoreCase); if (match.Success) { string parms = match.Groups[1].Value; string[] parmArr = parms.Split(','); _Id = parmArr[0]; _url = Uri.EscapeUriString(parmArr[1].Split('"')[1]); _linkID = parmArr[2].Split('"')[1]; _network = parmArr[3].Split('"')[1]; _code = Uri.UnescapeDataString(parmArr[5].Split('"')[1]); _Cpc = parmArr[6].Split('"')[1]; _Title = parmArr[7].Split('"')[1]; getFBLikesBef(_Id, _url, _network); } else { MessageBox.Show("Not match getFBLikesBef"); } match = Regex.Match(html, @"open\('(.*?)'\);", RegexOptions.IgnoreCase); if (match.Success) { string[] parmArr = match.Groups[1].Value.Split(','); _openLinkUrl = parmArr[0].Substring(0, parmArr[0].Length - 1); } else { MessageBox.Show("Not match Open popup"); } }
void Update() { this.step_timer += Time.deltaTime; // 状態変化待ち-----. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: // クリア条件を満たしていたら. if(this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; // クリア状態に移行. } break; } } // 状態が変化したら------. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.CLEAR: // block_rootを停止. this.block_root.enabled = false; // 経過時間をクリア時間として設定. this.clear_time = this.step_timer; break; } this.step_timer = 0.0f; } }
public override void start() { this.next_step = STEP.MOVE; // この敵が狙うプレイヤーを決定する // ひとまず一番最初に決まったプレイヤーにする focus = GameObject.FindGameObjectWithTag ("Player"); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); this.score_control = this.gameObject.GetComponent<ScoreControl>(); this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); this.next_step = STEP.PLAY; }
void Start() { curr_step = STEP.PLAY; // ���¸� ���������� initializeScore(); _scoreText = GetComponentInChildren<Text>(); _scoreText.fontSize = (int)(_scoreText.fontSize * ((Screen.width) / 1236f)); }
// 攻撃を受けたときの処理を開始する. public void AttackedFromPlayer(Vector3 blowout, Vector3 angular_velocity) { this.blowout_vector = blowout; this.blowout_angular_velocity = angular_velocity; // 親子関係を外しておく. // 親(OniGroup)が削除されるといっしょに削除されてしまうので. this.transform.parent = null; this.next_step = STEP.DEFEATED; }
void Start() { // BlockRoot스크립트 가져오기. this.block_root = this.gameObject.GetComponent<BlockRoot>(); // BlockRoot스크립트의 initialSetUp()을 호출한다. this.block_root.initialSetUp(); // ScoreCounter 가져오기 this.score_counter = this.gameObject.GetComponent<ScoreCounter>(); this.next_step = STEP.PLAY; // 다음 상태를 '플레이 중'으로. this.guistyle.fontSize = 24; // 폰트 크기를 24로. }
void Start() { // BlockRootスクリプトを取得. this.block_root = this.gameObject.GetComponent<BlockRoot>(); // BlockRootスクリプトのinitialSetUp()を呼び出す. this.block_root.initialSetUp(); // ScoreCounterを取得. this.score_counter = this.gameObject.GetComponent<ScoreCounter>(); this.next_step = STEP.PLAY; // 次の状態を「プレイ中」に. this.guistyle.fontSize = 24; // フォントのサイズを24に. }
// Update is called once per frame void Update() { // state change switch (step) { case STEP.IDLE: if (this.isDrag) { this.stepNext = STEP.DRAGGING; } break; case STEP.DRAGGING: if (!this.isDrag) { this.stepNext = STEP.IDLE; } break; } // state transition while (this.stepNext != STEP.NONE) { this.step = this.stepNext; this.stepNext = STEP.NONE; switch (this.step) { case STEP.DRAGGING: print("start drag" + this.name); this.beginDragging(); break; case STEP.IDLE: print("end drag" + this.name); break; } } // execute each state job switch (this.step) { case STEP.DRAGGING: this.doDragging(); break; } }
void Update() { this.step_timer += Time.deltaTime; // 変化待ち------. if(this.next_step == STEP.NONE){ switch(this.step){ case STEP.GLOW: // ぐんぐん成長する--------. glow_timer += Time.deltaTime; if(glow_timer >= GLOW_TREE_TIME){ this.next_step = STEP.TREE; } break; } } // 変化時------. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step){ case STEP.GLOW: break; case STEP.TREE: break; } } // 繰返し----. switch(step){ case STEP.GLOW: float size = Mathf.Lerp(0.2f, 0.8f, this.glow_timer/GLOW_TREE_TIME); this.transform.localScale = Vector3.one*size; break; case STEP.TREE: // 定期的にリンゴを作り出す--------. respawn_timer_apple += Time.deltaTime; if(respawn_timer_apple > RESPAWN_TIME_APPLE){ respawn_timer_apple = 0.0f; this.respawnApple(); } break; } }
public void Initialize(CsvBookParam _param, GameObject _goParent) { m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; m_bookParam = _param; string strLabel = _param.text; string strImage = _param.local_path + "/" + _param.name; if (0 == _param.status) { // なんもしない m_eStep = STEP.MAX; strLabel = "????"; strImage = "texture/still/secret"; } m_sprImage.sprite2D = SpriteManager.Instance.Load(strImage); m_lbText.text = strLabel; m_goParent = _goParent; }
private void OnFail(int causedBy) { string msg = StringMgr.Instance.Get("CHANNEL_MOVE_FAILED"); switch (causedBy) { case -1: msg = StringMgr.Instance.Get("FAIL_TO_JOIN_ROOM"); break; case -2: msg = StringMgr.Instance.Get("EXCEED"); break; case -3: msg = StringMgr.Instance.Get("WRONG_PSWD"); break; case -5: msg = StringMgr.Instance.Get("LOADING_WAIT"); break; case -6: msg = StringMgr.Instance.Get("CANT_BREAK_INTO"); break; case -4: msg = StringMgr.Instance.Get("NETWORK_FAIL"); break; } MessageBoxMgr.Instance.AddMessage(msg); if (step == STEP.LOBBY) { step = STEP.DESTINATION; Application.LoadLevel("Lobby"); } else { BuildOption.Instance.Exit(); } }
private void BinaryOperation(OPCODE opcode) { Data r = 0; Data a2 = Pop(), a1 = Pop(); switch (opcode) { case OPCODE.ADD: r = (double)a1 + a2; break; case OPCODE.SUB: r = (double)a1 - a2; break; case OPCODE.MUL: r = (double)a1 * a2; break; case OPCODE.DIV: if (a2 == 0f) { Result = STEP.ERROR; } r = (double)a1 / a2; break; case OPCODE.MOD: r = (double)a1 % a2; break; case OPCODE.SHR: r = a1 >> a2; break; case OPCODE.SHL: r = a1 << a2; break; } Push(r); }
public void Initialize(int _iSerial) { m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; m_bIsEnd = false; m_dataMonster = GameMain.dbMonster.Select(_iSerial); int iCleanLevel = 0; int iMealLevel = 0; m_dataMonster.GetConditions(ref iCleanLevel, ref iMealLevel); m_dispHungry.Set(iMealLevel); DataMonsterMaster master_data = GameMain.dbMonsterMaster.Select(m_dataMonster.monster_id); List <DataStaff> staff_list = GameMain.dbStaff.Select(string.Format(" item_serial={0}", m_dataMonster.item_serial)); m_ctrlDispMonsterDetailStaff.Initialize(staff_list); m_lbName.text = master_data.name; m_lbUriage.text = UtilString.GetSyuunyuu(master_data.revenew_coin, master_data.revenew_interval); //m_lbUriage.text = master_data.revenew_coin.ToString() + " / " + master_data.revenew_interval.ToString(); m_lbExp.text = master_data.revenew_exp.ToString(); m_lbCost.text = master_data.cost.ToString(); string strRarity = ""; for (int i = 0; i < master_data.rare; i++) { strRarity += "★"; } m_lbRarity.text = strRarity; //master_data.rare.ToString(); string strSpriteName = GetSpriteName(m_dataMonster.monster_id); UIAtlas atlas = AtlasManager.Instance.GetAtlas(strSpriteName); m_sprMonster.atlas = atlas; m_sprMonster.spriteName = strSpriteName; }
void Update() { this.step_timer += Time.deltaTime; // 상태 변화 대기 -----. if (this.next_step == STEP.NONE) { switch (this.step) { case STEP.CLEAR: if (Input.GetMouseButtonDown(0)) { SceneManager.LoadScene("Result"); } break; case STEP.PLAY: // 클리어 조건을 만족하면. if (this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; // 클리어 상태로 이행. } break; } } // 상태가 변화했다면 ------. while (this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch (this.step) { case STEP.CLEAR: // block_root를 정지. this.block_root.enabled = false; // 경과 시간을 클리어 시간으로 설정. this.clear_time = this.step_timer; break; } this.step_timer = 0.0f; } }
public override void Initialize() { m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; m_iGetTarget = 0; m_iTargetSerial = 0; m_Config.Load(CsvConfig.FILE_NAME); Debug.Log(Application.persistentDataPath); m_iTargetInterval = m_Config.ReadInt("target_interval"); m_dataTarget = new DataTarget(); m_dataTarget.Load(DataManager.Instance.FILENAME_TARGET_DATA); int make_num = m_Config.ReadInt(DataManager.Instance.KEY_TARGET_DEFAULT_NUM); if (DataManager.Instance.data_kvs.HasKey(DataManager.Instance.KEY_ADD_TARGET)) { int add_num = DataManager.Instance.data_kvs.ReadInt(DataManager.Instance.KEY_ADD_TARGET); make_num += add_num; } //Debug.LogError (make_num); AddTargetTail(make_num); /* * for (int i = 0; i < make_num ; i++) { * int iSerial = i + 1; * DataTargetParam targetParam = m_dataTarget.SelectOne (string.Format ("serial = {0}", iSerial)); * if (targetParam.serial == 0) { * targetParam.serial = iSerial; * targetParam.status = (int)DataTargetParam.STATUS.ACTIVE; * targetParam.time_destroy = TimeManager.StrGetTime (); * m_dataTarget.list.Add (targetParam); * } * m_targetList.Add (generateTarget (targetParam)); * } */ Debug.Log(m_dataTarget.list.Count); m_dataTarget.Save(DataManager.Instance.FILENAME_TARGET_DATA); }
// Update is called once per frame void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.IDLE: if (bInit) { foreach (SelectButton selectButton in m_selectButtonList) { selectButton.TriggerClear (); } } foreach (SelectButton selectButton in m_selectButtonList) { if (selectButton.ButtonPushed) { m_strSelectValue = selectButton.Index.ToString (); m_eStep = STEP.DECIDE; } } break; case STEP.DECIDE: if (bInit) { DataManager.Instance.kvs_data.Write (m_strSelectKey, m_strSelectValue); DataManager.Instance.kvs_data.Save (DataKvs.FILE_NAME); } m_eStep = STEP.END; break; case STEP.END: if (bInit) { m_bIsEnd = true; } break; case STEP.MAX: default: break; } }
//################# // Start //################# void Start() { //アニメーション制御の準備 animator = this.GetComponent <Animator> (); //アニメーションステート名のハッシュ値を取得 stateIdle = Animator.StringToHash("Base Layer.Idle"); stateAttack = Animator.StringToHash("Base Layer.Attack"); stateDamaged = Animator.StringToHash("Base Layer.Damaged"); //物理法則制御の準備 rgbody = this.GetComponent <Rigidbody>(); //効果音再生の準備 audiosrc = GetComponent <AudioSource>(); //攻撃判定オブジェクトを非アクティブにする transform.Find("AttackRange").gameObject.SetActive(false); //次ステップを「待機」に設定 this.nextStep = STEP.IDLE; }
//歩く動作関数 void RightWalk() { transform.rotation = Quaternion.Euler(0, -90.0f, 0); //iTween.MoveTo(obj, iTween.Hash("x", obj.transform.position.x - 1, "time", walk_time, "easetype", "linear")); iTween.ValueTo(obj, iTween.Hash("from", obj.transform.position, "to", obj.transform.position + new Vector3(-1, 0, 0), "time", walk_time, "easetype", "linear", "onupdate", "MovePlayer")); //Debug.Log(obj.name); //値の初期化 if (now_move != "right") { right = ChangeComandKey(); string new_text = "右に移動:" + right; scroll_control.ChangeText("right", new_text); right_arrow_text.text = right; now_move = "right"; } timer = 0; limit_timer = walk_time; step = STEP.MOVE; }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.step = STEP.NONE; this.next_step = STEP.WAIT; GlobalParam.getInstance().fadein_start = true; // 호스트 이름을 취득합니다. this.hostAddress = ""; string hostname = Dns.GetHostName(); // 호스트 이름에서 IP 주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); hostAddress = adrList[0].ToString(); GameObject obj = new GameObject("Network"); if (obj != null) { network_ = obj.AddComponent<Network>(); network_.RegisterReceiveNotification(PacketId.GameSyncInfo, OnReceiveSyncGamePacket); } }
// 오류 통지. void NotifyError() { GUISkin skin = GUI.skin; GUIStyle style = new GUIStyle(GUI.skin.GetStyle("button")); style.normal.textColor = Color.white; style.fontSize = 25; float sx = 450; float sy = 200; float px = Screen.width / 2 - sx * 0.5f; float py = Screen.height / 2 - sy * 0.5f; string message = "게임을 시작할 수 없습니다.\n\n버튼을 누르세요."; if (GUI.Button(new Rect(px, py, sx, sy), message, style)) { this.step = STEP.WAIT; this.next_step = STEP.NONE; } }
private void SendFile_Click(object sender, EventArgs e) { step = STEP.UPDATE; if (length > 2097152) { MessageBox.Show("Can not update file. Please select other file"); } else { try { SetText("Issue command 1: Update Request: "); myPort.Write(CMD_UPDATE); } catch { MessageBox.Show("Check connect port"); } } }
public void Initialize() { if (m_bInitialize == false) { m_bInitialize = true; m_eStep = STEP.INITIALIZE; m_eStepPre = STEP.MAX; m_goHit.SetActive(false); m_sprWhite.gameObject.SetActive(false); m_btnClose.gameObject.SetActive(false); m_switchSprite.gameObject.transform.localScale = Vector3.zero; m_lbMessage.text = "-------------"; m_WorkIdQueue.Clear(); m_fDispWait = 0.0f; } }
// Start is called before the first frame update void Start() { Debug.Log("S" + getTags_Obj("Trash")); IG = GameObject.Find("ItemGenerator").GetComponent <ItemGenerat>(); Max_Trash = IG.NumOfTrash + getTags_Obj("Trash"); Max_Living = IG.NumOfLiving + getTags_Obj("Living"); Debug.Log("N" + getTags_Obj("Trash")); player = GameObject.Find("Player").GetComponent <PlayerController>(); next_step = STEP.SET; // 最初はSETから. if (difLeft != 0 && ratLeft != 0) { leftOver = 0; } else if (difLeft > 0 && ratLeft == 0) { leftOver = difLeft; } else if (difLeft == 0 && ratLeft > 0) { leftOver = (int)(ratLeft / 100f * Max_Trash); } else { leftOver = 0; } if (leftOver > Max_Trash) { leftOver = Max_Trash - 1; } if (NextSceneName == "") { NextSceneName = SceneManager.GetActiveScene().name; Debug.Log(NextSceneName); } OneLoad = true; Debug.Log("E" + getTags_Obj("Trash")); }
public void SkitStart(List <string> _strMessageList, TYPE _eType) { // いったん閉じる Close(); m_eStep = STEP.DISP; m_iIndex = 0; m_strMessageList = _strMessageList; m_goRoot.SetActive(true); m_eType = _eType; switch (m_eType) { case TYPE.WINDOW: m_goWindow.SetActive(true); m_lbText = m_lbTextWindow; m_fMessageSpeed = DataManager.Instance.config.ReadFloat("message_speed_window"); m_btnPrev = m_btnPrevWindow; m_btnNext = m_btnNextWindow; m_btnEnd = m_btnEndWindow; break; case TYPE.ALL: AdManager.Instance.ShowIcon(GameMain.Instance.m_eAdType, false); m_goAll.SetActive(true); m_lbText = m_lbTextAll; m_fMessageSpeed = DataManager.Instance.config.ReadFloat("message_speed_all"); m_btnPrev = m_btnPrevAll; m_btnNext = m_btnNextAll; m_btnEnd = m_btnEndAll; break; default: break; } m_btnPrev.gameObject.SetActive(false); m_btnEnd.gameObject.SetActive(false); m_lbText.text = ""; }
private void OnLobby() { step = STEP.LOBBY; switch (Compass.Instance.Dst) { case Compass.DESTINATION_LEVEL.LOBBY: OnSuccess(Compass.Instance.GetDestinationLevel()); break; case Compass.DESTINATION_LEVEL.BATTLE_TUTOR: OnSuccess(Compass.Instance.GetDestinationLevel()); break; case Compass.DESTINATION_LEVEL.ROOM: SendCS_JOIN_REQ(); break; case Compass.DESTINATION_LEVEL.SQUAD: GlobalVars.Instance.ENTER_SQUADING_ACK(); break; } }
// Use this for initialization void Start() { goDir = GameObject.Find("FrontDir"); backDir = GameObject.Find("BackDir"); MapCamera = GameObject.Find("MiniMap"); animator = GetComponentInChildren <Animator>(); willson = GameObject.Find("WillsonTable"); game_root = GameObject.Find("GameRoot"); this.step = STEP.NONE; // 현 단계 상태를 초기화. this.next_step = STEP.MOVE; this.item_root = game_root.GetComponent <ItemRoot>(); this.guistyle.fontSize = 16; this.event_root = game_root.GetComponent <EventRoot>(); this.rocket_model = GameObject.Find("boat").transform.FindChild("boat_model").gameObject; this.game_status = game_root.GetComponent <GameStatus>(); dt = game_root.GetComponent <DayTime>(); _Torch = GameObject.Find("Torch"); _Torch.SetActive(false); }
void ChangeStep() { if (this.nextStep != STEP.NONE) { return; } switch (this.step) { case STEP.NONE: nextStep = STEP.FLYING; break; case STEP.FLYING: HitCheck(); if (lastHitResult.isHit) { nextStep = STEP.DESTRUCTED; } break; } }
public void Initialize(UISlider _slExp, UILabel _lbLevel, UILabel _lbAto, UILabel _lbMade, PopupAnimation _popupAnimation) { m_slExp = _slExp; m_lbLevel = _lbLevel; m_lbAto = _lbAto; m_lbMade = _lbMade; m_PopupAnimation = _popupAnimation; m_iTotalExp = GameMain.dbKvs.ReadInt(Define.USER_TOTAL_EXP); foreach (CsvLevelData level_data in DataManager.csv_level) { if (m_iTotalExp < level_data.need_exp) { break; } m_iLevel = level_data.level; } GameMain.dbKvs.WriteInt(Define.USER_LEVEL, m_iLevel); //m_iLevel = GameMain.dbKvs.ReadInt (Define.USER_LEVEL); m_iTotalExpTarget = GameMain.dbKvs.ReadInt(Define.USER_TOTAL_EXP); SetExp(m_iLevel, out m_iLevelExpNow, out m_iLevelExpNext); m_lbLevel.text = "Lv." + m_iLevel.ToString(); m_fValue = Define.GetValue(m_iTotalExp, m_iLevelExpNow, m_iLevelExpNext); m_slExp.value = m_fValue; m_lbAto.text = (m_iLevelExpNext - m_iTotalExp).ToString(); if (m_iLevel == Define.USER_LEVEL_MAX) { m_lbAto.text = "[FF0000]MAX[-]"; m_lbAto.transform.localPosition = new Vector3(m_lbAto.transform.localPosition.x, 37.0f, m_lbAto.transform.localPosition.z); m_lbMade.text = ""; } m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; return; }
// ================================================================ // // 방해 캐릭터에 닿았을 때 호출된다. public void onTouchEnemy(EnemyControl enemy) { do { if (this.step == STEP.TOUCH_ENEMY) { break; } if (this.step == STEP.MISS) { break; } if (this.step == STEP.OUT) { break; } this.next_step = STEP.TOUCH_ENEMY; Debug.Log("miss"); }while(false); }
void Update() { bool bInit = false; if (m_eStepPre != m_eStep) { m_eStepPre = m_eStep; bInit = true; } switch (m_eStep) { case STEP.NONE: case STEP.IDLE: if (0 < m_LoadAssetBundle.Count) { m_eStep = STEP.LOADING; } break; case STEP.LOADING: if (bInit) { m_strLoadingAssetBundleName = m_LoadAssetBundle.Dequeue(); Debug.Log(m_strLoadingAssetBundleName); m_csUtilAssetBundlePrefab.Load(m_strLoadingAssetBundleName); } if (m_csUtilAssetBundlePrefab.IsLoaded()) { m_eStep = STEP.IDLE; } break; case STEP.MAX: default: break; } }
// 초기화. void Init() { _iStage = 0; _UIStage.text = string.Format("{0} {1}", _sStage, _iStage + 1); _iStageScore = 0; _iTotalScore = 0; _iCurScore = 0; #if !UNITY_EDITOR if (GameService._Instance.IsConnected()) { _lBestScore = GameService._Instance.GetBestScore(); } else { _lBestScore = PlayerPrefs.GetInt("BestScore", 0); } #else _lBestScore = PlayerPrefs.GetInt("BestScore", 0); #endif _BoxMapManager.ClearBoxMap(); _BoxMapManager.Init(); _TouchManager.Init(); SetScore(0); SetBest(_lBestScore); _Step = STEP.START; _StartStep = START_STEP.SIZE; SetClear(false); SetOriginCount(2); _iADContinue = 1; }
// ================================================================ // void Start() { this.animator = this.GetComponentInChildren <Animator>(); // 攻撃判定用コライダーを探しておく. this.attack_collider = GameObject.FindGameObjectWithTag("AttackCollider").GetComponent <AttackColliderControl>(); // 攻撃判定用コライダーにプレイヤーのインスタンスをセットしておく. this.attack_collider.player = this; // 剣の軌跡エフェクト. this.kiseki_left = GameObject.FindGameObjectWithTag("FX_Kiseki_L").GetComponent <AnimatedTextureExtendedUV>(); this.kiseki_left.stopPlay(); this.kiseki_right = GameObject.FindGameObjectWithTag("FX_Kiseki_R").GetComponent <AnimatedTextureExtendedUV>(); this.kiseki_right.stopPlay(); // ヒットエフェクト. this.fx_hit = GameObject.FindGameObjectWithTag("FX_Hit").GetComponent <ParticleSystem>(); this.fx_run = GameObject.FindGameObjectWithTag("FX_Run").GetComponent <ParticleSystem>(); // this.run_speed = 0.0f; this.next_step = STEP.RUN; this.attack_voice_audio = this.gameObject.AddComponent <AudioSource>(); this.sword_audio = this.gameObject.AddComponent <AudioSource>(); this.miss_audio = this.gameObject.AddComponent <AudioSource>(); this.run_audio = this.gameObject.AddComponent <AudioSource>(); this.run_audio.clip = this.runSound; this.run_audio.loop = true; this.run_audio.Play(); }
// ================================================================ // void Start() { this.animator = this.GetComponentInChildren <Animator>(); // 查找用于攻击判定的碰撞器 this.attack_collider = GameObject.FindGameObjectWithTag("AttackCollider").GetComponent <AttackColliderControl>(); // 设置用于攻击判定的碰撞器的玩家实例 this.attack_collider.player = this; // 剑的轨迹特效 this.kiseki_left = GameObject.FindGameObjectWithTag("FX_Kiseki_L").GetComponent <AnimatedTextureExtendedUV>(); this.kiseki_left.stopPlay(); this.kiseki_right = GameObject.FindGameObjectWithTag("FX_Kiseki_R").GetComponent <AnimatedTextureExtendedUV>(); this.kiseki_right.stopPlay(); // 击中时的特效 this.fx_hit = GameObject.FindGameObjectWithTag("FX_Hit").GetComponent <ParticleSystem>(); this.fx_run = GameObject.FindGameObjectWithTag("FX_Run").GetComponent <ParticleSystem>(); // this.run_speed = 0.0f; this.next_step = STEP.RUN; this.attack_voice_audio = this.gameObject.AddComponent <AudioSource>(); this.sword_audio = this.gameObject.AddComponent <AudioSource>(); this.miss_audio = this.gameObject.AddComponent <AudioSource>(); this.run_audio = this.gameObject.AddComponent <AudioSource>(); this.run_audio.clip = this.runSound; this.run_audio.loop = true; this.run_audio.Play(); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.step = STEP.NONE; this.next_step = STEP.WAIT; GlobalParam.getInstance().fadein_start = true; // 호스트 이름을 취득합니다. this.hostAddress = ""; string hostname = Dns.GetHostName(); // 호스트 이름에서 IP 주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); hostAddress = adrList[0].ToString(); GameObject obj = new GameObject("Network"); if (obj != null) { network_ = obj.AddComponent <Network>(); } }
public void Initialize( ref List<CsvScriptParam> _scriptParamList ) { m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; // 内部から呼び出す WindowStart (); m_strSelectKey = GetSelectKey (_scriptParamList [0].param); int iSelectNum = int.Parse (_scriptParamList [0].option1); _scriptParamList.RemoveAt (0); for (int i = 0; i < iSelectNum; i++) { SelectButton script = PrefabManager.Instance.MakeScript<SelectButton> ("prefab/SelectButton", m_gridSelectRoot.gameObject); script.Initialize (_scriptParamList [0]); m_selectButtonList.Add (script); _scriptParamList.RemoveAt (0); } m_gridSelectRoot.enabled = true; return; }
public override void PageStart() { m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; base.PageStart(); m_lbTitle.text = "チャプター選択"; m_closeButton = PrefabManager.Instance.MakeObject("prefab/CloseButton", gameObject).GetComponent <ButtonBase>(); m_closeButton.TriggerClear(); if (m_btnManager == null) { m_btnManager = gameObject.AddComponent <ButtonManager> (); } m_btnManager.ButtonRefresh(); foreach (CsvChapterParam param in DataManager.Instance.csv_chapter.list) { ChapterBanner script = PrefabManager.Instance.MakeScript <ChapterBanner> ("prefab/ChapterBanner", m_grid.gameObject); script.Initialize(param); m_btnManager.AddButtonBase(script.gameObject); } m_btnManager.ButtonInit(); NendAdInterstitial.Instance.Show(); }
// ================================================================ // // 继承于MonoBehaviour void Start() { this.room_control = RoomControl.get(); this.scene_control = SceneControl.get(); this.effect_control = EffectControl.get(); // this.is_grounded = false; GetComponent <AudioSource>().clip = START_SOUND; GetComponent <AudioSource>().Play(); this.previous_velocity = Vector3.zero; this.next_step = STEP.STAND; this.coli_result = new NekoColiResult(); this.coli_result.neko = this; this.coli_result.create(); this.action_stand.is_fade_anim = true; }
public void Init(int _iNokoriSec, int _iDepth, int _iItemId) { int iUseDepth = _iDepth + 5; m_sprBack.depth = iUseDepth; m_lbNokoriTime.depth = iUseDepth + 1; m_lbName.depth = iUseDepth + 1; CsvItemData item_data = DataManager.GetItem(_iItemId); m_lbName.text = item_data.name; m_eStep = STEP.INIT; m_eStepPre = STEP.MAX; // これはあまり意味ないかも m_iNokoriSec = _iNokoriSec; SetNokoriSec(m_iNokoriSec); //m_sprBack.gameObject.transform.localScale = new Vector3 (1.0f, 0.0f, 1.0f); return; }
public void Initialize(CsvStaffData _csvStaffData, int _iCostNokori) { m_bIsUserData = false; m_eStep = STEP.IDLE; m_eStepPre = STEP.MAX; m_lbTitle.text = _csvStaffData.name; m_lbTitle2.text = _csvStaffData.name; m_lbDescription.text = _csvStaffData.description; // コスト m_lbPrize.text = _csvStaffData.cost.ToString(); string strIcon = GetSpriteName(_csvStaffData); UIAtlas atlas = AtlasManager.Instance.GetAtlas(strIcon); m_sprIcon.atlas = atlas; m_sprIcon.spriteName = strIcon; SetPrice(_csvStaffData); m_lbDifficulty.text = _csvStaffData.expenditure.ToString() + "/1時間"; m_buttonBase = GetComponent <ButtonBase> (); m_dataStaff = new DataStaff(); m_dataStaff.staff_id = _csvStaffData.staff_id; m_dataStaff.staff_serial = 0; m_bAbleUse = DataManager.user.AbleBuy(_csvStaffData.coin, _csvStaffData.ticket, _csvStaffData.cost, _iCostNokori, 0, 0, ref m_eReason); SetReasonSprite(m_sprReason, m_eReason); m_sprIgnoreBlack.gameObject.SetActive(!m_bAbleUse); SetEnableIcon(m_bAbleUse); return; }
public int through_count = 0; // 穴が開いた後に通りぬけた回数. // ---------------------------------------------------------------- // // Use this for initialization void Start() { this.scene_control = SceneControl.get(); for (int i = 0; i < this.transform.childCount; i++) { GameObject child = this.transform.GetChild(i).gameObject; switch (child.tag) { case "SyoujiPaper": { this.paper_object = child; } break; case "SyoujiPaperBroken": { this.broken_object = child; } break; case "SyoujiSteel": { this.steel_object = child; } break; } } this.paper_object.SetActive(false); this.broken_object.SetActive(false); this.steel_object.SetActive(false); this.next_step = STEP.PAPER; }
void Update() { this.step_timer += Time.deltaTime; if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: if(this.game_status.isGameClear()) { // クリア状態に移行. this.next_step = STEP.CLEAR; } if(this.game_status.isGameOver()) { // ゲームオーバー状態に移行. this.next_step = STEP.GAMEOVER; } if(this.step_timer > GAME_OVER_TIME ) { // 制限時間を超えていたらゲームオーバー. this.next_step = STEP.GAMEOVER; } break; // クリア時およびゲームオーバー時の処理. case STEP.CLEAR: case STEP.GAMEOVER: if(Input.GetMouseButtonDown(0)) { // マウスボタンが押されたらGameSceneを再読み込み. Application.LoadLevel("GameScene"); } break; } } while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.CLEAR: // PlayerControlを制御不可に. this.player_control.enabled = false; // 現在の経過時間でクリア時間を更新. this.clear_time = this.step_timer; break; case STEP.GAMEOVER: // PlayerControlを制御不可に. this.player_control.enabled = false; break; } this.step_timer = 0.0f; } }
void Update() { this.step_timer += Time.deltaTime; switch(this.step) { case STEP.CLEAR: if(Input.GetMouseButtonDown(0)) { Application.LoadLevel("TitleScene"); } break; } // 状態変化待ち-----. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: // クリア条件を満たしていたら. if(this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; // クリア状態に移行. } break; } } // 状態が変化したら------. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.CLEAR: // block_rootを停止. this.block_root.enabled = false; // 経過時間をクリア時間として設定. this.clear_time = this.step_timer; break; } this.step_timer = 0.0f; } }
void Start() { this.game_status = this.gameObject.GetComponent<GameStatus>(); this.player_control = GameObject.Find("Player").GetComponent<PlayerControl>(); this.step = STEP.PLAY; this.next_step = STEP.PLAY; this.guistyle.fontSize = 64; }
// Update is called once per frame void Update() { bool bInit = false; if( m_eStepPre != m_eStep ){ m_eStepPre = m_eStep; bInit = true; Debug.Log( m_eStep ); } if( m_bFinishStart == false ){ //Debug.Log( GameManager.Instance.State ); if( GameManager.Instance.State == GameManager.STATE.GOAL ){ m_bFinishStart = true; m_eStep = STEP.GOAL; Debug.Log("Clear"); } else if( GameManager.Instance.State == GameManager.STATE.GAMEOVER ){ m_bFinishStart = true; m_eStep = STEP.GAMEOVER; Debug.Log("GameOver"); } else { } } switch( m_eStep ) { case STEP.WAIT: if( bInit ){ m_fShotPower = 0.0f; m_slShotPower.value = m_fShotPower; } if( m_csPlayer.Step == PlayerController.STEP.IDLE ){ m_eStep = STEP.IDLE; } break; case STEP.IDLE: if (bInit) { Debug.Log ("1"); clearInput (); Debug.Log ("2"); } float v = Input.GetAxis ("Vertical"); // 入力デバイスの垂直軸をvで定義 moveAngle (v); if (IsPushed ()) { m_eStep = STEP.BUTTON_RELEASE_CHECK; m_eStep = STEP.SHOT_START; } break; /* case STEP.BUTTON_RELEASE_CHECK: if( !Input.GetKey(KeyCode.Space) ){ m_eStep = STEP.SHOT_START; } break; */ case STEP.SHOT_START: if (bInit) { m_fTimer = 0.0f; clearInput (); } m_fTimer += (Time.deltaTime / m_fShotPowerInterval); bool bEnd = false; if (IsPushed ()) { bEnd = true; } else if( m_fShotPowerInterval < m_fTimer ){ m_fTimer = m_fShotPowerInterval; bEnd = true; } if( bEnd ){ m_eStep = STEP.SHOT; } m_fShotPower = GetShotPower( m_fTimer , m_fShotPowerInterval ); m_slShotPower.value = m_fShotPower; //Debug.Log( "shotpower=" + m_fShotPower); break; case STEP.SHOT: if( bInit ){ Vector3 dir = m_csCamera.gameObject.transform.forward; dir.y = 0.3f + m_fShotAngleValue * 0.5f; m_csPlayer.Shot( dir , m_fShotPower*m_fPowerController ); m_iShotCount += 1; m_txtPower.text = "打数:" + m_iShotCount.ToString(); } m_eStep = STEP.KOROKORO; break; case STEP.KOROKORO: if( m_csPlayer.IsStop()){ m_eStep = STEP.END; } m_eStep = STEP.END; break; case STEP.END: if( bInit ){ } m_fShotPower -= 0.05f; if( m_fShotPower < 0.0f ){ m_fShotPower = 0.0f; m_eStep = STEP.IDLE; } m_slShotPower.value = m_fShotPower; break; case STEP.GOAL: if( bInit) { m_goResult.transform.localPosition = new Vector3( 1.0f * m_fWindowHalf , 0.0f , 0.0f ); m_txtResult.text = "ゴール!!!"; } Vector3 tempMoveGoal = m_goResult.transform.localPosition; tempMoveGoal.x -= 15.0f; m_goResult.transform.localPosition = tempMoveGoal; if( tempMoveGoal.x < -1.0f * m_fWindowHalf ){ m_eStep = STEP.GAME_END; } break; case STEP.GAMEOVER: if( bInit) { m_goResult.transform.localPosition = new Vector3( 1.0f * m_fWindowHalf , 0.0f , 0.0f ); m_txtResult.text = "ゲームオーバー"; } Vector3 tempMoveGameover = m_goResult.transform.localPosition; tempMoveGameover.x -= 15.0f; m_goResult.transform.localPosition = tempMoveGameover; if( tempMoveGameover.x < -1.0f * m_fWindowHalf ){ m_eStep = STEP.GAME_END; } break; case STEP.GAME_END: if (bInit) { m_goResult.transform.localPosition = new Vector3 (0.0f, 0.0f, 0.0f); m_txtGotoTitlet.transform.localPosition = new Vector3 (0.0f, -60.0f, 0.0f); clearInput (); } if (IsPushed ()) { GameManager.Instance.NextScene(); } break; case STEP.MAX: default: break; } }
void Update() { // ---------------------------------------------------------------- // // ステップ内の経過時間を進める. this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 次の状態に移るかどうかを、チェックする. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: if(this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; } break; case STEP.CLEAR: if(eff_clear_pos_y <=0.0f){ if(Input.GetMouseButtonDown(0)) { // this.next_step = STEP.RESULT; this.next_step = STEP.CLICK_ACTION; } } break; case STEP.CLICK_ACTION: if(this.step_timer > ACTION_TIME) { this.next_step = STEP.RESULT; } break; } } // ---------------------------------------------------------------- // // 状態が遷移したときの初期化. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.PLAY: this.sound_control.playBgm(Sound.BGM.BGM1); break; case STEP.CLEAR: // ブロックの入れ替えなどをできないように. this.block_root.enabled = false; this.clear_time = this.step_timer; Debug.Log(this.step_timer +"/"+ this.clear_time); this.sound_control.stopBgm(); eff_clear_pos_y = 32.0f; this.rocket_motion.Play("02_launchingstart"); this.sound_control.playSound(Sound.SOUND.GAME_CLEAR); break; case STEP.CLICK_ACTION: this.rocket_motion.Play("03_launching"); this.sound_control.playSound(Sound.SOUND.CLICK); break; case STEP.RESULT: // ブロックの入れ替えなどをできないように. this.block_root.enabled = false; int ignit = this.score_counter.bestIgnit(); Debug.Log("CLEAR TIME= "+ this.clear_time); GlobalParam.getInstance().setLastScore( this.clear_time, ignit); Application.LoadLevel("resultScene"); break; } this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 各状態での実行処理. switch(this.step) { case STEP.PLAY: break; case STEP.CLEAR: break; } // ---------------------------------------------------------------- // }
// ================================================================ // // 방해 캐릭터에 닿았을 때 호출된다. public void onTouchEnemy(EnemyControl enemy) { do{ if(this.step == STEP.TOUCH_ENEMY) break; if(this.step == STEP.MISS) break; if(this.step == STEP.OUT) break; this.next_step = STEP.TOUCH_ENEMY; Debug.Log("miss"); }while(false); }
void Start() { this.step = STEP.NONE; // 현 단계의 상태를 초기화. this.next_step = STEP.MOVE; // 다음 단계의 상태를 초기화. this.item_root = GameObject.Find("GameRoot").GetComponent<ItemRoot>(); this.guistyle.fontSize = 16; this.event_root = GameObject.Find("GameRoot").GetComponent<EventRoot>(); this.rocket_model = GameObject.Find("rocket").transform.FindChild( "rocket_model").gameObject; this.game_status = GameObject.Find("GameRoot").GetComponent<GameStatus>(); }
// ================================================================ // // MonoBehaviour からの継承. void Start() { this.block_root = this.gameObject.GetComponent<BlockRoot>(); this.block_root.create(); this.block_root.initialSetUp(); this.score_counter = this.gameObject.GetComponent<ScoreCounter>(); this.next_step = STEP.PLAY; this.score_disp = GameObject.FindGameObjectWithTag("Score Disp").GetComponent<ScoreDisp>(); this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); this.rocket_motion = GameObject.Find("rocket_model").gameObject.GetComponentInChildren<Animation>(); //motion }
// Update is called once per frame void Update() { Vector3 velocity = this.GetComponent<Rigidbody>().velocity; // ---------------------------------------------------------------- // // 클릭 후의 경과 시간. // // 착지 직후에 버튼을 클릭해도 캐릭터가 점프해 주지 않는 경우가 있다. // 원인은 착지 직후에 버턴을 클릭했다고 생각하지만 실제로는 // 착지 직전에 클릭하기 때문이다. // 이런 때라도 점프할 수 있도록 '클릭한 순간'의 판정이 // 몇 프레임에 이어지도록 한다. // if(Input.GetMouseButtonDown(0)) { this.click_timer = 0.0f; } else { if(this.click_timer >= 0.0f) { this.click_timer += Time.deltaTime; } } // ---------------------------------------------------------------- // // 스피드 컨트롤. this.current_speed = this.level_control.getPlayerSpeed(); // --------------------------------------------------------------- // // 유니티 처리 엔진의 특성?으로 바닥 블록의 이음메에서 울퉁불퉁 뛰어오르므로 // 억지로 아래로 눌러 붙인다. if(this.step == STEP.TOUCH_ENEMY) { } else { if(this.is_colided) { if(velocity.y > Physics.gravity.y*Time.deltaTime) { velocity.y = Physics.gravity.y*Time.deltaTime; this.GetComponent<Rigidbody>().velocity = velocity; } } // '착지했는가?' 조사한다. // (원래는 유니티의 기능을 사용하면 충분하지만 밀어내기로 // 공중에 떠버리는 경우도 있으니 각자 조사한다). // this.check_landed(); } // ---------------------------------------------------------------- // // 화면 아래로 떨어지면 실패. switch(this.step) { case STEP.RUN: case STEP.JUMP: { if(this.transform.position.y < NARAKU_HEIGHT) { this.next_step = STEP.MISS; } } break; } // ---------------------------------------------------------------- // // 스텝 내의 경과 시간을 진행한다. this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 다음 상태로 이동할지 검사한다. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.RUN: { // 마우스의 왼쪽 버튼이 눌렸으면 점프. if(0.0f <= this.click_timer && this.click_timer <= CLICK_GRACE_TIME) { if(this.is_landed || this.is_colided) { this.click_timer = -1.0f; this.next_step = STEP.JUMP; } else { // 발밑에 바닥이 없을 때는 점프할 수 없다. } } } break; case STEP.JUMP: { // 착지했으면 달리기로. if(this.is_launched) { if(this.is_landed) { this.sound_control.playSound(Sound.SOUND.TDOWN); if(this.stepped_block != null) { this.stepped_block.onStepped(); } this.next_step = STEP.RUN; } } } break; case STEP.TOUCH_ENEMY: { if(this.transform.position.y < NARAKU_HEIGHT) { this.next_step = STEP.OUT; } } break; } } // ---------------------------------------------------------------- // // 상태가 전환됐을 때의 초기화. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.RUN: { this.is_launched = false; this.anim_player.CrossFade("02_Move", 0.1f); //motion } break; case STEP.JUMP: { velocity.y = PlayerControl.calcJumpVelocityY(); this.is_launched = false; this.is_key_released = false; this.anim_player.CrossFade("03_jumpup", 0.1f); //motion this.sound_control.playSound(Sound.SOUND.JUMP); // 점프 시의 음성은 jump1 jump2를 임의로 계속 재생하고 30%의 확률로 재생되지 않을 정도로 조정한다. int rnd = Random.Range(0,3); switch(rnd){ case 0: this.sound_control.playSound(Sound.SOUND.JUMP1); break; case 1: this.sound_control.playSound(Sound.SOUND.JUMP2); break; } } break; case STEP.TOUCH_ENEMY: { // 적에게 닿았다. // 화면 아래로 사라져가도록 충돌을 무효로 한다. this.GetComponent<Collider>().enabled = false; this.next_step = STEP.MISS; } break; case STEP.MISS: { velocity.y = PlayerControl.calcBikkuriVelocityY(); velocity.x = 0.0f; this.GetComponent<Collider>().enabled = false; this.anim_player.CrossFade("05_died", 0.1f); //motion this.sound_control.playSound(Sound.SOUND.JINGLE); } break; } this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리 switch(this.step) { case STEP.RUN: { // 오른쪽 방향으로 가속 velocity.x += PlayerControl.ACCELERATION*Time.deltaTime; // 최대 속도 이상이 되지 않도록. if(Mathf.Abs(velocity.x) > this.current_speed) { velocity.x *= this.current_speed/Mathf.Abs(velocity.x); } } break; case STEP.JUMP: { if(!this.is_landed || this.is_key_released || velocity.y <= 0.0f) { this.is_launched = true; } // 점프 중에 왼쪽 버튼을 떼면, 상승 속도를 줄인다. // (왼쪽 버튼을 누른 길이로 점프 높이를 제어할 수 있게 한다.) do { if(Input.GetMouseButton(0)) { break; } // 한 번 버튼에서 손을 떼면 다음은 하지 않는다(연타대책). if(this.is_key_released) { break; } // 하강 중엔 하지 않는다. if(velocity.y <= 0.0f) { break; } // velocity.y *= JUMP_KEY_RELEASE_REDUCE; this.is_key_released = true; } while(false); if(velocity.y <= 0.0f){ this.anim_player.CrossFade("04_jumpdown", 0.3f); // motion. } } break; case STEP.MISS: { // 감속. velocity.x -= PlayerControl.ACCELERATION*Time.deltaTime; // 0.0 이하가 되지 않도록. if(velocity.x < 0.0f) { velocity.x = 0.0f; } } break; case STEP.TOUCH_ENEMY: { velocity.x = 0.0f; } break; } // '점프 중 코인을 떨어뜨린다'의 컨트롤. this.coin_drop_control(); // ---------------------------------------------------------------- // this.GetComponent<Rigidbody>().velocity = velocity; this.passage_time += Time.deltaTime; this.is_colided = false; //this.is_landed = false; // ---------------------------------------------------------------- // // 디버그용 무적 모드. #if true if(Input.GetMouseButtonDown(1)) { this.is_debug_immortal = !this.is_debug_immortal; if(this.is_debug_immortal) { this.GetComponent<Collider>().enabled = false; this.GetComponent<Rigidbody>().useGravity = false; this.GetComponent<Rigidbody>().velocity = new Vector3(this.GetComponent<Rigidbody>().velocity.x, 0.0f, this.GetComponent<Rigidbody>().velocity.z); } else { this.GetComponent<Collider>().enabled = true; this.GetComponent<Rigidbody>().useGravity = true; } } #endif }
// やられたときに呼ばれる. public override void onVanished() { this.next_step = STEP.VANISH; }
void Update() { // ---------------------------------------------------------------- // // 스텝 내 경과시간 진행. this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.PLAY: if(this.score_counter.isGameClear()) { this.next_step = STEP.CLEAR; } break; case STEP.CLEAR: if(eff_clear_pos_y <=0.0f){ if(Input.GetMouseButtonDown(0)) { // this.next_step = STEP.RESULT; this.next_step = STEP.CLICK_ACTION; } } break; case STEP.CLICK_ACTION: if(this.step_timer > ACTION_TIME) { this.next_step = STEP.RESULT; } break; } } // ---------------------------------------------------------------- // // 상태가 전환됐을 때의 초기화. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.PLAY: this.sound_control.playBgm(Sound.BGM.BGM1); break; case STEP.CLEAR: // 블록 교체 등을 할 수 없도록. this.block_root.enabled = false; this.clear_time = this.step_timer; Debug.Log(this.step_timer +"/"+ this.clear_time); this.sound_control.stopBgm(); eff_clear_pos_y = 32.0f; this.rocket_motion.Play("02_launchingstart"); this.sound_control.playSound(Sound.SOUND.GAME_CLEAR); break; case STEP.CLICK_ACTION: this.rocket_motion.Play("03_launching"); this.sound_control.playSound(Sound.SOUND.CLICK); break; case STEP.RESULT: // 블록 교체 등을 할 수 없도록. this.block_root.enabled = false; int ignit = this.score_counter.bestIgnit(); Debug.Log("CLEAR TIME= "+ this.clear_time); GlobalParam.getInstance().setLastScore( this.clear_time, ignit); Application.LoadLevel("resultScene"); break; } this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch(this.step) { case STEP.PLAY: break; case STEP.CLEAR: break; } // ---------------------------------------------------------------- // }
public override void execute() { if (isPaused) { return; } // ---------------------------------------------------------------- // // ステップ内の経過時間を進める. this.step_timer_prev = this.step_timer; this.step_timer += Time.deltaTime; // ---------------------------------------------------------------- // // 次の状態に移るかどうかを、チェックする. if(this.next_step == STEP.NONE) { switch(this.step) { case STEP.WAIT: if (step_timer >= SPAWN_INTERVAL) { this.next_step = STEP.SPAWN; } break; default: break; } } // ---------------------------------------------------------------- // // 状態が遷移したときの初期化. while(this.next_step != STEP.NONE) { this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { default: break; } this.step_timer_prev = 0.0f; this.step_timer = 0.0f; } // ---------------------------------------------------------------- // // 各状態での実行処理. switch (this.step) { case STEP.SPAWN: getMyController().createEnemy (); this.next_step = STEP.WAIT; break; default: break; } // ---------------------------------------------------------------- // this.damage_trigger = false; }
public override void start() { this.next_step = STEP.WAIT; }
void Update() { this.get_input(); // 입력 정보를 가져온다. this.step_timer += Time.deltaTime; float eat_time = 0.5f; // 사과는 2초 걸려서 먹는다. // 2.0f→0.5f. float repair_time = 0.5f; // 수리에 걸리는 시간도 2초.// 2.0f→0.5f. // 상태를 변화시킨다 --------------------. if(this.next_step == STEP.NONE) { // 다음 예정이 없으면. switch(this.step) { case STEP.MOVE: // '이동중'상태의 처리. do { if(! this.key.action) { // 액션키가 눌려있지 않으면. break; // 루프 탈출. } // 주목 중인 이벤트가 있을 때. if(this.closest_event != null) { if(! this.is_event_ignitable()) { // 이벤트가 시작 불가면. break; // 아무것도 하지 않는다. } // 이벤트 종류 취득. Event.TYPE ignitable_event = this.event_root.getEventType(this.closest_event); switch(ignitable_event) { case Event.TYPE.ROCKET: // 이벤트 종류가 ROCKET이면. // REPAIRING(수리) 상태로 이행. this.next_step = STEP.REPAIRING; break; } break; } if(this.carried_item != null) { // 들고 있는 아이템 판별. Item.TYPE carried_item_type = this.item_root.getItemType(this.carried_item); switch(carried_item_type) { case Item.TYPE.APPLE: // 사과. case Item.TYPE.PLANT: // 식물. // '식사중'상태로 이행. this.next_step = STEP.EATING; break; } } } while(false); break; case STEP.EATING: // '식사중' 상태의 처리. if(this.step_timer > eat_time) { // 2초 대기. this.next_step = STEP.MOVE; // '이동' 상태로 이행. } break; case STEP.REPAIRING: // '수리중' 상태의 처리. if(this.step_timer > repair_time) { // 2초 대기. this.next_step = STEP.MOVE; // '이동' 상태로 이행. } break; } } // 상태가 변화한 경우------------. while(this.next_step != STEP.NONE) { // 상태가 NONE이외 = 상태가 변화했다. this.step = this.next_step; this.next_step = STEP.NONE; switch(this.step) { case STEP.MOVE: break; case STEP.EATING: // '식사 중' 상태의 처리. if(this.carried_item != null) { // 들고 있는 아이템의 '체력 회복 정도'를 가져와서 설정. this.game_status.addSatiety( this.item_root.getRegainSatiety(this.carried_item)); // 들고 있는 아이템은 폐기.. GameObject.Destroy(this.carried_item); this.carried_item = null; } break; case STEP.REPAIRING: // '수리 중'이 되었다면. if(this.carried_item != null) { // 들고 있는 아이템의 '수리 진척 상태'를 가져와서 설정. this.game_status.addRepairment( this.item_root.getGainRepairment(this.carried_item)); // 들고 있는 아이템을 삭제. GameObject.Destroy(this.carried_item); this.carried_item = null; this.closest_item = null; } break; } this.step_timer = 0.0f; } // 각 상태에서 반복할 것----------. switch(this.step) { case STEP.MOVE: this.move_control(); this.pick_or_drop_control(); // 이동 가능한 경우는 항상 배가 고파진다. this.game_status.alwaysSatiety(); break; case STEP.REPAIRING: // 우주선을 회전시킨다. this.rocket_model.transform.localRotation *= Quaternion.AngleAxis( 360.0f / 10.0f * Time.deltaTime, Vector3.up); break; } }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { this.next_step = STEP.RUN; this.current_speed = SPEED_MIN; this.score_control = ScoreControl.getInstance(); this.coin_creator = CoinCreator.getInstance(); this.anim_player = this.transform.GetComponentInChildren<Animation>(); //motion. this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>(); }