void OnTriggerEnter(Collider collider) { Debug.Log("trigger enter"); Debug.Log(collider.name); if (collider.tag == "Sword") { bool critical = Random.Range(0, 2) == 1; double damage = critical ? PlayerStatus.Attack * 2 : PlayerStatus.Attack; if (critical) { m_monsterController.GetAttack(MonsterController.DamageType.SwordCritical, damage); } else { m_monsterController.GetAttack(MonsterController.DamageType.Sword, damage); } Vector3 contactPoint = this.GetComponent <CapsuleCollider>().ClosestPoint(m_playerTransform.position); SpawnSwordAttackParticleEffects(contactPoint, Quaternion.identity); SwordAttackCameraShakeEffects(); } //if (collider.tag == "Fu") //{ // m_monsterController.GetAttack(10); //} }
private void Tm_CollisionEnter_FireBall(object sender, RFX4_TransformMotion.RFX4_CollisionInfo e) { Debug.Log(e.Hit.transform.name); //will print collided object name to the console. Transform hitTransform = e.Hit.transform; if (hitTransform.tag == "Ice") { hitTransform.GetComponent <IceFragBurst>().Do(); } MonsterCollider monsterCollider = e.Hit.transform.GetComponent <MonsterCollider>(); if (monsterCollider) { MonsterController monsterController = monsterCollider.GetMonsterController(); monsterController.GetAttack(MonsterController.DamageType.Fu, PlayerStatus.FireBallAttack); //monsterCollider.GetMonsterController().GetAttack(fireBallAttack); } }