Ejemplo n.º 1
0
    public void GetTarget(int _damage, Transform _boss)
    {
        if (Lect.DistanceCheck(transform, playerTransform, hitDistance))
        {
            return;
        }

        if (!damageFlag)
        {
            // 플레이어에게 대미지
            if (!playerHit.IsInvincible)
            {
                playerHit.FrontBackCheck(playerTransform, _boss);
                playerHit.SwordHit(1);
                if (Flat.Instance.GetGround())
                {
                    playerHit.BeHitSword();
                }
                else
                {
                    playerHit.BeHitAir();
                }
                player.DecreaseHp(_damage);
            }

            if (!damageInterval.Equals(0) && !damageFlag)
            {
                damageFlag = true;
                StartCoroutine(TimeSpan());
            }
        }
    }
Ejemplo n.º 2
0
    private IEnumerator Shoot()
    {
        while (true)
        {
            int count = 0;
            while (count < attackCount)
            {
                count++;

                Vector3 dest = Lect.RandomPosOnCenter(player.position, 0f, 2f);

                line.enabled = true;
                line.SetPosition(1, dest + Vector3.up * 5f);

                if (Vector3.Distance(player.position, dest) < 0.5f)
                {
                    //맞았을 경우 대미지
                    if (!playerHit.IsInvincible)
                    {
                        playerHUD.DecreaseHp(damage);
                        //playerHit.FrontBackCheck(player, transform);
                        //playerHit.GunHit(1);
                        if (Flat.Instance.GetGround())
                        {
                            playerHit.BeHitGun();
                        }
                        else
                        {
                            playerHit.BeHitAir();
                        }
                    }
                }

                float val2 = 1f;
                while (val2 > 0f)
                {
                    line.SetPosition(0, transform.position);

                    val2           -= Time.fixedDeltaTime * attackSpeed;
                    line.startWidth = val2;
                    line.endWidth   = val2;

                    yield return(new WaitForFixedUpdate());
                }
                line.enabled = false;
            }

            yield return(new WaitForSeconds(Mathf.Abs(attackCycle)));
        }
    }
Ejemplo n.º 3
0
 private void OnCollisionEnter(Collision col)
 {
     if (!isBreakable)
     {
         return;
     }
     if (col.transform.CompareTag("Player"))
     {
         //대미지 및 기타효과
         hud.DecreaseHp(damage);
     }
     //이펙트
     //파괴
     StopAllCoroutines();
     Destroy(gameObject);
 }
Ejemplo n.º 4
0
    public void RailGunEffect()
    {
        if (!playerHit.IsInvincible)
        {
            Vector3 origin = muzzle.position;
            Vector3 dest   = boss.transform.forward;
            //playerCenter = player.GetComponent<BoxCollider>().bounds.center;
            //Vector3 dir = (playerCenter - muzzle.position).normalized;

            if (Physics.Raycast(origin, dest, out hit, 200f, 1 << 9 | 1 << 13, QueryTriggerInteraction.Ignore))
            {
                StartCoroutine(RangeLine(origin, hit.point));

                GameObject effect1 = ObjectPool.Instance.PopFromPool("RailBoom");
                //GameObject effect2 = ObjectPool.Instance.PopFromPool("GatlingBoom");
                effect1.transform.position = hit.point;
                //effect2.transform.position = hit.point;
                effect1.SetActive(true);
                //effect2.SetActive(true);

                if (hit.transform.CompareTag("Player"))
                {
                    playerHUD.DecreaseHp(rangeDamage);
                    playerHit.FrontBackCheck(player, boss);
                    playerHit.GunHit(1);

                    if (Flat.Instance.GetGround())
                    {
                        playerHit.BeHitGun();
                    }
                    else
                    {
                        playerHit.BeHitAir();
                    }
                }
            }
            else
            {
                StartCoroutine(RangeLine(origin, dest * 200f));
            }
        }
    }