private void OnTriggerEnter(Collider other) { //プレイヤーに当たってしまうので応急処置 if (other.tag == "Player") { return; } if (!canHitToAttacker) { //TODO:プレイヤーとミサイルが当たるので応急処置 var core = GetComponentInParent <Health>(); if (core != null) { if (core.gameObject == attacker) { return; } } //if (collision.gameObject == attacker) // return; } if (other.tag == "Player") { return; } var obj = Instantiate(hitEffect, transform.position, transform.rotation); //hp 削る //print("missile hit"); var health = other.gameObject.GetComponentInParent <IDamageable>(); if (health != null) { health.ApplyDamage(damage, attacker); } if (hitSoundPrefab != null) { Instantiate(hitSoundPrefab, transform.position, Quaternion.identity); } if (OnMissileHit != null) { var t = other.transform; OnMissileHit.Invoke(t); } Destroy(gameObject); }
static Packets() { try { Attack = new OnAttack(); MissileHit = new OnMissileHit(); } catch (Exception) { //ignored } }
static Packets() { try { Attack = new OnAttack(); MissileHit = new OnMissileHit(); Disengaged = new OnDisengaged(); MonsterSkill = new OnMonsterSkill(); CreateGromp = new OnCreateGromp(); CreateCampIcon = new OnCreateCampIcon(); } catch (Exception) { //ignored } }
public void SetOnMissileHit(OnMissileHit onHitFn) { onMissileHitFn = onHitFn; }