private void OnTriggerStay(Collider other) { if (other.gameObject.tag == "Block") { HyperBlock hyperBlock = other.gameObject.GetComponent <HyperBlock>(); if (hyperBlock.status == HyperBlock.Status.Nomal) { GameObject obj = Instantiate(SystemCtrl.blockVFX, hyperBlock.transform.position, hyperBlock.transform.rotation); //ブロックが集まってくる演出をインスタント obj.GetComponent <BlockVFX>().target = master.transform; Destroy(other.gameObject); } } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Character")//プレイヤーへの攻撃 { //collision.gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0); CharacterrCtrl character = collision.gameObject.GetComponent <CharacterrCtrl>(); if (character.invincible == false) { if (collision.gameObject.GetComponent <PlayerPvECtrl>().RideOnTank == true) { collision.gameObject.GetComponent <PlayerPvECtrl>().Tank.GetComponent <Tank>().TankLife -= AttackDamage; collision.gameObject.GetComponent <PlayerPvECtrl>().tankLife(); SoundManager.PlayS(collision.gameObject, "SE_Damage"); StartCoroutine(character.Invincible()); StartCoroutine(Stan(2f)); } else { SoundManager.PlayS(collision.gameObject, "SE_Damage"); //character.hp -= AttackDamage; StartCoroutine(character.Invincible()); direction = TargetPos - transform.position; dis = direction.magnitude; direction = direction / dis; collision.gameObject.GetComponent <Rigidbody>().velocity = new Vector3(direction.x * knockBackRange, 0, direction.z * knockBackRange); StartCoroutine(Stan(2f)); } } } else if (collision.gameObject.tag == "Block")//ブロックの破壊 { HyperBlock hb = collision.gameObject.GetComponent <HyperBlock>(); hb.blockLife--; hb.BlendShape(); if (hb.canNotCollect == true && hb.blockLife <= 0) { Destroy(collision.gameObject); } if (isStartStan == true) { if (gw != null) { gw.SummonCount++; } Destroy(this.gameObject); } rb.velocity = new Vector3(0, 0, 0); StartCoroutine(Stan(5f)); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Character" && mode == 0)//プレイヤーへの攻撃 { //collision.gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 0); CharacterrCtrl character = collision.gameObject.GetComponent <CharacterrCtrl>(); if (character.invincible == false) { if (collision.gameObject.GetComponent <PlayerPvECtrl>().RideOnTank == true) { collision.gameObject.GetComponent <PlayerPvECtrl>().Tank.GetComponent <Tank>().TankLife -= AttackDamage; collision.gameObject.GetComponent <PlayerPvECtrl>().tankLife(); if (character.gameObject.GetComponent <PlayerPvECtrl>().RideOnTank == true) { SoundManager.PlayS(collision.gameObject, "SE_Tank_Damage"); } else { SoundManager.PlayS(collision.gameObject, "SE_Damage"); } StartCoroutine(character.Invincible()); StartCoroutine(Stan(2f)); } else { //character.hp -= AttackDamage; SoundManager.PlayS(collision.gameObject, "SE_Damage"); StartCoroutine(character.Invincible()); StartCoroutine(Stan(2f)); } } } else if (collision.gameObject.tag == "Block" && isStaned == false)//ブロックの破壊 { HyperBlock hb = collision.gameObject.GetComponent <HyperBlock>(); hb.blockLife--; hb.BlendShape(); StartCoroutine(Stan(5f)); rb.velocity = -rb.velocity; if (hb.canNotCollect == true && hb.blockLife <= 0) { Destroy(collision.gameObject); } } }
public void BlockCollect() //ブロック回収 { GameObject[] blocks = GameObject.FindGameObjectsWithTag("Block"); int collectedNum = 0; foreach (GameObject blockObj in blocks) { HyperBlock hb = blockObj.GetComponent <HyperBlock>(); if (hb.isMove == false && hb.canNotCollect == false) { collectedNum += 1; StartCoroutine(blockObj.GetComponent <HyperBlock>().BackToMaster()); } } if (collectedNum > 0) { SoundManager.PlayS(gameObject, "SE_PickUp_1"); StartCoroutine(BlockCollectSoundPlay()); } }