Esempio n. 1
0
    /// <summary>
    /// 当たった時
    /// </summary>
    /// <param name="other"></param>
    protected override void OnTriggerEnter(Collider other)
    {
        //既に逃げ始めている
        if (IsEscape)
        {
            if (other.CompareTag(ConstTags.RunAwayPoint))
            {
                DestroyMe();
            }

            return;
        }

        // プレイヤの攻撃
        if (other.CompareTag(ConstTags.PlayerAttack))
        {
            var hito = other.GetComponent <HitObject>();

            bool isHit = !HitLog.CheckLog(hito);
            if (isHit)
            {
                SwtichHitted(hito);
                hito.DamageHp(MyHp);
                return;
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// 当たり始めの判定
    /// </summary>
    /// <param name="other"></param>
    protected virtual void OnTriggerEnter(Collider other)
    {
        //既に逃げ始めている
        if (IsEscape)
        {
            if (other.CompareTag(ConstTags.RunAwayPoint))
            {
                DestroyMe();
            }

            return;
        }

        // プレイヤの攻撃
        if (other.CompareTag(ConstTags.PlayerAttack))
        {
            var hito = other.GetComponent <HitObject>();

            bool isHit = !HitLog.CheckLog(hito);
            if (isHit)
            {
                // 攻撃元の座標を受け取る
                HittedPlayerAttack(hito.ParentHit.myPlayer.GetPlayerObj());

                SwtichHitted(hito);
                hito.DamageHp(MyHp);
                CameraChance(hito);
                return;
            }
        }

        // ターゲット通過
        if (other.CompareTag(ConstTags.EnemyCheckPoint))
        {
            TargetIndex++;
            NextTargetSearch();
        }
        else if (other.CompareTag(ConstTags.City))
        {
            NextTargetSearch();
        }
    }