Ejemplo n.º 1
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));
            }
        }
    }