Example #1
0
 public void OnTriggerEnter(Collider other)
 {
     //プレイヤーが生成範囲に入ったら生成する
     if (TagNameManager.Equals(other.tag, TagName.Player))
     {
         Spawn();
     }
 }
 protected override void OnHit(Collider collider)
 {
     if (TagNameManager.Equals(collider.tag, TagName.Player))
     {
         DamageSource damage = new DamageSource(collider.ClosestPoint(this.transform.position),
                                                power, holderEnemyAI);
         collider.GetComponent <PlayerAction>().OnHit(damage);
     }
 }
    private void OnTriggerExit(Collider other)
    {
        TagName otherTag = TagNameManager.GetKeyByValue(other.tag);

        if (otherTag == TagName.EnemyDeadArea)
        {
            EnemyAI enemy = other.GetComponentInParent <EnemyAI>();
            player.FarEnemy(enemy);
        }
    }
Example #4
0
 private void OnTriggerEnter(Collider other)
 {
     //プレイヤーと当たったらプレイヤーにダメージ
     if (TagNameManager.Equals(other.tag, TagName.Player))
     {
         //衝突したときの最近点を衝突点とする
         Vector3      hitPos = other.ClosestPointOnBounds(this.transform.position);
         DamageSource damage = new DamageSource(hitPos, power, holderObjectDamagable);
         //相手に当たったと通知
         other.gameObject.GetComponent <IDamageable>().OnHit(damage);
     }
 }
Example #5
0
    protected override void OnHit(Collider collider)
    {
        if (isHit)
        {
            return;
        }

        Debug.Log("thunder hurioroshi hit");

        if (TagNameManager.Equals(collider.tag, TagName.Player))
        {
            DamageSource damage = new DamageSource(collider.ClosestPoint(this.transform.position),
                                                   power, holderEnemyAI);
            collider.GetComponent <PlayerAction>().OnHit(damage);
        }
    }
Example #6
0
    private void OnTriggerEnter(Collider other)
    {
        //敵に当たったら通知する
        if (TagNameManager.Equals(other.tag, TagName.Enemy))
        {
            //攻撃が複数回ヒットしないように
            if (!countDict.ContainsKey(other.gameObject))
            {
                countDict[other.gameObject] = 1;
            }
            else if (countDict[other.gameObject] >= 1)
            {
                return;
            }

            AudioManager.Instance.PlayPlayerSE(AudioName.CutHit.String());

            //衝突したときの最近点を衝突点とする
            Vector3      hitPos = other.ClosestPointOnBounds(this.transform.position);
            DamageSource damage = new DamageSource(hitPos, power, holderObjectDamagable);
            //相手に当たったと通知
            other.gameObject.GetComponent <IDamageable>().OnHit(damage);
        }
    }