IEnumerator AICoroutine() { while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { while (isPouse) { yield return(null); } // 以下の処理(1フレーム間)で行動を決定する if (distance < changePhase) { //ある程度近づいたらカメラに向かう yield return(StartCoroutine(TargetRun())); yield return(StartCoroutine(AttackCoroutine())); yield return(StartCoroutine(SusideCoroutine())); } else { yield return(StartCoroutine(RunCoroutine())); } if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } if (!enemy.IsLife) { yield break; } } }
IEnumerator AttackCoroutine() { enemy.isSuperArmor = true; if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } //Debug.Log("攻撃中"); animPlayer.PlayAnimation(G20_AnimType.Attack); //なげるアニメーションの実行 yield return(new WaitForSeconds(attacktime / enemy.Speed)); //アニメーション終了と同時に爆弾の親変更と爆弾の動く処理実行 if (!enemy.IsLife || !bomb) { yield break; } bomb.Bombthrow(attackRange, enemy.Attack); bomb.transform.parent = enemy.transform.parent; bomb = null; }
protected IEnumerator SusideCoroutine() { while (true) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } transform.position += Time.deltaTime * deathvec; if (transform.position.y < deathposition_y) { if (!enemy.IsLife) { yield break; } //Debug.Log("自殺"); GetComponent <G20_Unit>().ExecuteDeathAction(G20_Unit.G20_DamageType.Enemy); Destroy(gameObject); } yield return(null); } }
//難易度、その日の最高スコア取得 IEnumerator ScoreReceiveCoroutine() { //Debug.Log("スコア表受信開始 " // +"\n日付:"+date // +"\n難易度:" + G20_StageManager.GetInstance().stageType +"("+ (int)G20_StageManager.GetInstance().stageType+")"); WWWForm form = new WWWForm(); form.AddField("date", date); form.AddField("difficulty", G20_GameManager.GetInstance().gameDifficulty); WWW www = new WWW(scoreReceiveAdress, form); yield return(www); if (!string.IsNullOrEmpty(www.error)) { is_network = false; //Debug.Log("ネットワークエラー"); yield break; } string jsonText = "{ \"scoreList\" : " + www.text + "}"; //Debug.Log("jsonText" + jsonText); userData = JsonUtility.FromJson <G20_SQLModel>(jsonText); yield return(null); }
// 奥から地面の高さを出てくる演出 IEnumerator WalkForward(GameObject ene) { var enemy = ene.GetComponent <G20_Enemy>(); //float[] rotPatern = { -45.0f, -22.5f, 22.5f, 45.0f }; //ene.transform.Rotate(0, rotPatern[Random.Range(0, rotPatern.Length)], 0); StartCoroutine(InvisibleDuringTime(ene, 0.3f)); //魔法陣が出来てから少し間を置く yield return(new WaitForSeconds(0.3f)); while (ene && enemy.HP > 0 && ene.transform.position.y < 0) { ene.transform.position = new Vector3(0, 0, -walkForwardSpeed * Time.deltaTime); yield return(null); } if (!ene || !enemy.IsLife) { yield break; } // 敵AI開始 if (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { var eneAI = ene.GetComponent <G20_Enemy>().EnemyAI; if (eneAI) { eneAI.AIStart(); } } }
IEnumerator RunCoroutine() { animPlayer.PlayAnimation(G20_AnimType.Run); runTime = (targetPos.x - transform.position.x) * runTimeRate; if (runTime < 0) { runTime *= (-1); } if (runTime < runTimeMin) { runTime = runTimeMin; } for (float t = 0; t < runTime; t += AITime) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } transform.position += transform.forward * AITime; if (distance <= changePhase) { // 走ってる途中で近くなったので終了 yield break; } yield return(null); } }
// 下から出てくる演出 IEnumerator RiseUp(GameObject ene) { var enemy = ene.GetComponent <G20_Enemy>(); //float[] rotPatern = { -45.0f, -22.5f, 22.5f, 45.0f }; //ene.transform.Rotate(0, rotPatern[Random.Range(0, rotPatern.Length)], 0); //魔法陣が出来てから少し間を置く yield return(new WaitForSeconds(0.3f)); while (ene && enemy.HP > 0 && ene.transform.position.y < 0) { ene.transform.position += new Vector3(0, riseUpSpeed * Time.deltaTime, 0); yield return(null); } if (!ene || !enemy.IsLife) { yield break; } // Y座標を0に補正 Vector3 pos = ene.transform.position; ene.transform.position = new Vector3(pos.x, 0, pos.z); // 敵AI開始 if (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { var eneAI = ene.GetComponent <G20_Enemy>().EnemyAI; if (eneAI) { eneAI.AIStart(); } } }
public Vector2?GetShotPoint() { if (!CanShoot()) { return(null); } //タイトル時にタイトルアップルを狙う if (G20_GameManager.GetInstance().gameState == G20_GameState.TITLE) { var num = UnityEngine.Random.Range(0, titleApples.Length); return(Camera.main.WorldToScreenPoint(titleApples[num].transform.position)); } var shotPoint = SearchShotPoint(); if (shotPoint != null) { var radius = param[paramNumber].baseOffsetRadius; var randDir = GetRandomDir(); shotPoint += radius * randDir; var randRad = param[paramNumber].addRandOffsetRadius; shotPoint += randDir * UnityEngine.Random.Range(0, randRad); return(shotPoint); } return(null); }
private void Update() { if (G20_GameManager.GetInstance().IsGesslerBattle) { Destroy(gameObject); } }
IEnumerator BulletRoutine() { while (isTargetingPlayer) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME || owner.HP <= 0) { RecvDamage(HP, G20_DamageType.System); } transform.Translate(moveVec * moveSpeed * Time.deltaTime, Space.World); //transform.Rotate(-100.0f*Time.deltaTime*moveSpeed,0,0); if (radius >= Vector3.Distance(Camera.main.transform.position, transform.position)) { G20_EnemyAttack.GetInstance().Attack(1); RecvDamage(HP, G20_DamageType.System); } yield return(null); } particle.SetActive(false); gameObject.layer = LayerMask.NameToLayer(diedLayer); var rh = GetComponent <Rigidbody>(); rh.isKinematic = false; var vec = transform.position - Camera.main.transform.position; rh.AddForce(vec * rollingPower, ForceMode.Impulse); yield return(new WaitForSeconds(rollingDuration)); Destroy(gameObject); }
// Use this for initialization void Start() { if (is_network) { IPReceive(); G20_GameManager.GetInstance().ChangedStateAction += Scoresend; G20_GameManager.GetInstance().ChangedStateAction += Scorereceive; } }
private void Start() { defaultColors = new Color[paramImages.Length]; for (int i = 0; i < defaultColors.Length; i++) { defaultColors[i] = paramImages[i].color; } G20_GameManager.GetInstance().ChangedStateAction += StartRoutine; }
IEnumerator TargetJump() { //体の向き回転 Vector3 targetfront = distanceVec.normalized; targetfront.y = 0; for (float t = 0; t < rotationTime; t += AITime) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } var newRotation = Quaternion.LookRotation(targetfront).eulerAngles; newRotation.x = 0; //ずれ防止のため newRotation.z = 0; //ずれ防止のため transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(newRotation), rotspeed); yield return(null); } yield return(null); if (!enemy.IsLife) { yield break; } //ジャンプモーション開始 animPlayer.PlayAnimation(G20_AnimType.Jump); G20_SEManager.GetInstance().Play(G20_SEType.SMALL_APPLE_ATTACK, Vector3.zero, false); yield return(new WaitForSeconds(1.0f / enemy.anim.AnimSpeed)); //放物線 float hight = 0; while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME && transform.position.y >= -0.1f) { transform.position += (!enemy.IsLife ? -1 : 1) * transform.forward * Time.deltaTime * enemy.Speed; if (!enemy.IsLife && init_v > 0) { init_v = 0; } init_v -= gravity * Time.deltaTime * (!enemy.IsLife ? 4 : 1); hight += init_v * Time.deltaTime; transform.position = new Vector3(transform.position.x, hight, transform.position.z); if (distance < attackRange) { // 走ってる途中で近くなったので終了 yield break; } yield return(null); } }
void InputChangeDiff() { if (Input.GetKeyDown(KeyCode.Alpha0)) { G20_GameManager.GetInstance().gameDifficulty = 0; } if (Input.GetKeyDown(KeyCode.Alpha1)) { G20_GameManager.GetInstance().gameDifficulty = 1; } }
private void Awake() { //クリア時無敵 G20_GameManager.GetInstance().ChangedStateAction += _state => { if (_state == G20_GameState.CLEAR) { IsInvincible = true; } }; }
IEnumerator AttackCoroutine() { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } //Debug.Log("攻撃中"); G20_EnemyAttack.GetInstance().Attack(enemy.Attack); // Debug.Log("攻撃終了"); }
IEnumerator AICoroutine() { while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { while (isPouse) { yield return(null); } // 以下の処理(1フレーム間)で行動を決定する // ターゲットが目の前にいたら攻撃する if (distance < attackRange) { // 攻撃選択 yield return(StartCoroutine(AttackCoroutine())); yield return(StartCoroutine(SusideCoroutine())); } else if (distance < changePhase) { //ある程度近づいたらカメラに向かう yield return(StartCoroutine(TargetJump())); } else { //向き変更とまっすぐ進むを交互に if (rotated) { yield return(StartCoroutine(RunCoroutine())); rotated = false; } else { yield return(StartCoroutine(RotateCoroutine())); rotated = true; } } if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } if (!enemy.IsLife) { yield break; } } }
IEnumerator RunCoroutine() { animPlayer.PlayAnimation(G20_AnimType.Run); while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { transform.position += transform.forward * AITime; if (distance < changePhase) { yield break; } yield return(null); } }
public void IngameStart() { var stageType = G20_GameManager.GetInstance().gameDifficulty; if (stageType >= stageBehaviourPrefabs.Length) { stageType = 0; } var stageObj = Instantiate(stageBehaviourPrefabs[(int)stageType], transform); nowStageBehaviour = stageObj.GetComponent <G20_StageBehaviour>(); float stageTotalTime = nowStageBehaviour.stageTotalTime; G20_Timer.GetInstance().StartTimer(stageTotalTime); }
private IEnumerator CountTimer() { while (CurrentTime >= 0) { if (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { CurrentTime -= Time.deltaTime; } yield return(null); } if (TimerZeroAction != null) { TimerZeroAction(); } }
// 空中から出現する // Use this for initialization void Start() { timer = stageTotalTime; enemyPopper = G20_ComponentUtility.FindComponentOnScene <G20_EnemyPopper>(); enemyCabinet = G20_EnemyCabinet.GetInstance(); // ポップ位置情報の確保 popPositions = enemyPopper.transform.GetComponentsInChildren <G20_EnemyPopPosition>(); Array.Sort(popPositions, (a, b) => a.number - b.number); gameManager = G20_GameManager.GetInstance(); scoreAppleCanPopTimeMin = stageTotalTime * 0.1f; SequenceEnter(); }
void ShowRank() { var sumScore = G20_ScoreManager.GetInstance().GetSumScore(); var resultParam = resultParams[G20_GameManager.GetInstance().gameDifficulty]; resultParam.resultParams.Sort((a, b) => b.scoreCondition - a.scoreCondition); foreach (var i in resultParam.resultParams) { if (sumScore >= i.scoreCondition) { rankText.text = i.text; rankText.color = i.color; return; } } }
// Update is called once per frame void Update() { if (updateCall <= 0 && gameManager.gameState != G20_GameState.INGAME) { return; } updateCall--; if (sequenceCounter >= popSequenceList.Length) { // これ以上敵出現しない return; } if (gameManager.gameState == G20_GameState.INGAME) { timer -= Time.deltaTime; popTimer += Time.deltaTime; } SequenceUpdate(); ScoreAppleUpdate(); // 状態遷移判定 if (IsNextStateCondition()) { sequenceCounter++; if (sequenceCounter < popSequenceList.Length) { //シーケンスに設定されたインゲームの演出開始 if (popSequenceList[sequenceCounter].InGamePerformer) { popSequenceList[sequenceCounter].InGamePerformer.GetComponent <G20_IngamePerformer>().StartPerformance(); } } else { // これ以上敵出現しない // ゲスラー戦へ移行 G20_GameManager.GetInstance().StartGesslerBattle(); //Debug.Log("ゲスラー戦"); return; } SequenceEnter(); } }
IEnumerator RotateCoroutine() { bool _isRight = isRight; for (float t = 0; t < rotationTime; t += AITime) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } transform.Rotate(0, rot * AITime * (_isRight ? 1 : -1), 0); transform.position += transform.forward * (AITime / 2); yield return(null); } }
IEnumerator AttackCoroutine() { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } //Debug.Log("攻撃中"); animPlayer.PlayAnimation(G20_AnimType.Attack); yield return(new WaitForSeconds(attacktime / enemy.Speed)); if (!enemy.IsLife) { yield break; } G20_EnemyAttack.GetInstance().Attack(enemy.Attack); }
IEnumerator AppleFlyRoutine() { while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME && isTargeting) { moveVec.y -= gravity * Time.deltaTime; transform.Translate(moveVec * enemy.Speed * Time.deltaTime, Space.World); transform.up = moveVec; appleModel.Rotate(0, 360 * spinSpeed * Time.deltaTime, 0); if (radius >= Vector3.Distance(Camera.main.transform.position, transform.position)) { G20_EnemyAttack.GetInstance().Attack(enemy.Attack); yield return(StartCoroutine(SusideCoroutine())); } if (deathposition_y >= transform.position.y) { yield return(StartCoroutine(SusideCoroutine())); } yield return(null); } }
IEnumerator TargetRun() { animPlayer.PlayAnimation(G20_AnimType.Stance); enemy.isSuperArmor = true; //向き変更 Vector3 targetfront = distanceVec.normalized; targetfront.y = 0; for (float t = 0; t < 1.0f; t += AITime) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } var newRotation = Quaternion.LookRotation(targetfront).eulerAngles; newRotation.x = 0; //ずれ防止のため newRotation.z = 0; //ずれ防止のため transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(newRotation), rotspeed); yield return(null); } yield return(null); //走る animPlayer.PlayAnimation(G20_AnimType.Dash); while (G20_GameManager.GetInstance().gameState == G20_GameState.INGAME) { transform.position += transform.forward * AITime; if (distance < attackRange) { // 走ってる途中で近くなったので終了 yield break; } yield return(null); } }
IEnumerator TargetRun() { animPlayer.PlayAnimation(G20_AnimType.Run); //向き変更 Vector3 targetfront = distanceVec.normalized; targetfront.y = 0; for (float t = 0; t < rotationTime; t += AITime) { if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { //Debug.Log("インゲーム状態を抜けたのでAIを終了"); yield break; } var newRotation = Quaternion.LookRotation(targetfront).eulerAngles; newRotation.x = 0; //ずれ防止のため newRotation.z = 0; //ずれ防止のため transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(newRotation), rotspeed); yield return(null); } }
IEnumerator ScoreSendCoroutine() { if (!is_network) { yield break; } WWWForm form = new WWWForm(); form.AddField("userinfo", "Guest"); form.AddField("date", date); form.AddField("score", G20_ScoreManager.GetInstance().GetSumScore()); form.AddField("ID", userIDstr); form.AddField("difficulty", (int)G20_GameManager.GetInstance().gameDifficulty);//どっかからとってこれるようにする? WWW www = new WWW(scoreSendAdress, form); yield return(www); //Debug.Log(www.text); yield return(null); }
IEnumerator CheckEnemyHit() { while (true) { //インゲームじゃなかったら終了 if (G20_GameManager.GetInstance().gameState != G20_GameState.INGAME) { yield break; } var colliders = Physics.OverlapBox(transform.position, halfBox, transform.rotation); bool isHit = false; foreach (var col in colliders) { if (col.GetComponent <G20_HitDamage>()) { isHit = true; break; } } if (isHit) { foreach (var i in paramImages) { i.color = changeColor; } } else { for (int i = 0; i < paramImages.Length; i++) { paramImages[i].color = defaultColors[i]; } } yield return(new WaitForSeconds(0.5f)); } }