void OnTriggerStay2D(Collider2D c) { if (commonCharaAttack.checkTargetCollider(c) == false) { return; } intervalCnt += 1; if (intervalCnt == 30) { intervalCnt = 0; } int tmpDm; tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 2); tmpDm = 1; commonCharaAttack tmpAtk = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); switch (intervalCnt) { case 0: clystalList[0].setAttack(c.transform.position, tmpAtk); break; case 5: clystalList[1].setAttack(c.transform.position, tmpAtk); break; case 10: clystalList[2].setAttack(c.transform.position, tmpAtk); break; } }
void OnTriggerStay2D(Collider2D c) { if (commonCharaAttack.checkTargetCollider(c) == false) { return; } int tmpDm; switch (thisChara.thisChara.charaNo) { case enumCharaNum.sion_08: if ((intervalCnt % 120) != 0) { return; } tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 2); commonCharaAttack tmpAtk06 = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); //チェックと実行 tmpAtk06.exec(); parentFM.setMovingFlag(false); thisZombiAnime.SetTrigger("setAttack"); animeFreezSec = 3f; break; } }
IEnumerator startDamageCount(commonCharaAttack argsDm) { yield return(new WaitForSeconds(0.06f)); argsDm.exec(); attackMotionFlag = false; }
void OnTriggerEnter2D(Collider2D c) { if (commonCharaAttack.checkTargetCollider(c) == false) { return; } switch (thisChara.thisChara.charaNo) { case enumCharaNum.sion_08: default: int tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 4); commonCharaAttack tmpAtk = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); //チェックと実行 tmpAtk.exec(); break; } }
void OnTriggerStay2D(Collider2D c) { if (commonCharaAttack.checkTargetCollider(c) == false) { return; } int tmpDm; switch (thisChara.thisChara.charaNo) { case enumCharaNum.mokuren_06: if ((intervalCnt % 10) != 0) { return; } tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 2); commonCharaAttack tmpAtk06 = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); //チェックと実行 tmpAtk06.exec(); break; case enumCharaNum.akane_04: if ((intervalCnt % 5) != 0) { return; } tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 4); commonCharaAttack tmpAtk04 = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); //チェックと実行 tmpAtk04.exec(); break; } }
public void setAttack(Vector3 argsTargetPosi, commonCharaAttack argsDm) { attackMotionFlag = true; float MaxRandomWarpRange = 2f; Vector3 tmpV3 = Random.insideUnitCircle * MaxRandomWarpRange; //クリスタル自体のランダムワープ this.transform.localPosition = tmpV3; GameObject retGO = Instantiate(_prefabBullet) as GameObject; retGO.transform.position = this.transform.position; retGO.GetComponent <charaSkill_SakuraClystalBullet> ().setEndPosision(argsTargetPosi); GameObject retGO2 = Instantiate(_prefabParticle) as GameObject; retGO2.transform.position = this.transform.position; StartCoroutine(startDamageCount(argsDm)); }
void OnTriggerEnter2D(Collider2D c) { if (commonCharaAttack.checkTargetCollider(c) == false) { return; } switch (thisChara.thisChara.charaNo) { case enumCharaNum.akane_04: case enumCharaNum.mokuren_06: //stayで処理するのでEnterは何もしない break; case enumCharaNum.houzuki_05: case enumCharaNum.suzusiro_03: //防御系は charaSkillDefenceColliderScript break; case enumCharaNum.sakura_07: //サクラは charaSkillColliderSakuraScript を使うので注意 break; case enumCharaNum.syusuran_02: case enumCharaNum.enju_01: case enumCharaNum.hiragi_09: default: int tmpDm = Mathf.FloorToInt(thisChara.getCharaDamage()) + Mathf.FloorToInt(Random.value * 4); commonCharaAttack tmpAtk = new commonCharaAttack(c.gameObject, thisChara.gameObject, tmpDm); //チェックと実行 tmpAtk.exec(); break; } }
IEnumerator mostNearEnemyAttacking() { Vector3 tmpV; float minLength = 99999f; Transform nearTarget = null; //再接近ターゲットの確認 foreach (Transform t in lastFrameAttackTarget) { if (t != null) { tmpV = t.transform.position - this.transform.position; if (tmpV.magnitude < minLength) { minLength = tmpV.magnitude; nearTarget = t; } } } //アタックコライダの使用フラグ attackDeleyFlag = true; //移動硬直 parentCharaScrpt.setMovingFreeze(); thisAnimetor.SetTrigger("gotoAttack"); //暫定で10フレームのアニメーションwaitを置く for (int loopI = 0; loopI < 3; loopI++) { yield return(null); } if (nearTarget == null) { //ターゲットが他キャラが同一フレームで倒した場合,攻撃モーション中に消滅した場合、ここを通る //即終了 Debug.Log("破壊済みオブジェクトを攻撃"); attackDeleyFlag = false; lastFrameAttackTarget.Clear(); yield break; } int tmpDm = Mathf.FloorToInt(parentCharaScrpt.getCharaDamage()) + Mathf.FloorToInt(Random.value * 4); commonCharaAttack tmpAtk = new commonCharaAttack(nearTarget.gameObject, parentCharaScrpt.gameObject, tmpDm); //チェックと実行 if (tmpAtk.exec() == false) { Debug.Log("攻撃判定を失敗"); attackDeleyFlag = false; lastFrameAttackTarget.Clear(); yield break; } //AttackLineの表示 GameObject tmpAttackLine = Instantiate(_attackLine) as GameObject; Vector3[] tmpV3 = new Vector3[] { parentCharaScrpt.transform.position, nearTarget.transform.position }; tmpAttackLine.GetComponent <LineRenderer> ().SetPositions(tmpV3); lastFrameAttackTarget.Clear(); //Attack Cycleの表示 //攻撃時のサークル表示はうざいので一旦止めてみる //parentCharaScrpt.setAttackCycleShow(); float tmpAttackDeley = parentCharaScrpt.thisChara.battleStatus.thisInfo.attackDelayTime; //アタックディレイ yield return(StartCoroutine(attackDeleyClearer(tmpAttackDeley))); }