//エフェクト生成処理 private void CreateEffect(HitSelect EffectType, Transform trans) { switch (EffectType) { case HitSelect.Hit: NewHitEffect = (GameObject)Instantiate(HitPrefab, transform.position, Quaternion.identity); break; case HitSelect.Critical: NewHitEffect = (GameObject)Instantiate(CriticalPrefab, transform.position, Quaternion.identity); break; } NewHitEffect.GetComponent <Transform>().LookAt(trans); HitParticle = NewHitEffect.GetComponent <ParticleSystem>(); //NewHitEffect.GetComponent<Transform>().localScale = new Vector3(1, 1, 1); }
//吹き飛ばし処理 private void BlowAway(GameObject HitObject, HitSelect EffectType) { //親のRigidbodyを探す Rigidbody HitRigid = HitObject.transform.root.gameObject.GetComponent <Rigidbody>(); PlayerController hitPlayer = HitObject.transform.root.gameObject.GetComponent <PlayerController>(); //サンドバック用点数など加算しないようにする if (HitObject.transform.root.gameObject.name == "SandBack(Clone)") { switch (EffectType) { case HitSelect.Hit: //AddForceを入れる(衝撃を与えるのでForceModeはImpulse HitRigid.AddForce(this.transform.position * m_paramTable.normalHitPower, ForceMode.Impulse); break; case HitSelect.Critical: HitStop(); //AddForceを入れる(衝撃を与えるのでForceModeはImpulse HitRigid.AddForce(this.transform.position * m_paramTable.criticalHitPower, ForceMode.Impulse); break; } return; } // 誰に吹き飛ばされたかを保持 hitPlayer.BlowAwayNow(P_Controller.PlayerID); switch (EffectType) { case HitSelect.Hit: //AddForceを入れる(衝撃を与えるのでForceModeはImpulse HitRigid.AddForce(this.transform.position * m_paramTable.normalHitPower, ForceMode.Impulse); break; case HitSelect.Critical: HitStop(); //AddForceを入れる(衝撃を与えるのでForceModeはImpulse HitRigid.AddForce(this.transform.position * m_paramTable.criticalHitPower, ForceMode.Impulse); // Add:弓達 クリティカルヒット時得点付与 BattlePoint.AddCriticalPoint(hitPlayer.PlayerID, P_Controller.PlayerID); Debug.Log("クリティカルヒット my:" + transform.root + "your:" + HitObject); break; } }