Пример #1
0
    public void SetPushOption(float pushRadius, float pushPower, int pushDamage)
    {
        bulletDestroyAction = BulletDestroyAction.Gravity;

        this.pushRadius = pushRadius;
        this.pushPower  = pushPower;
        this.pushDamage = pushDamage;
    }
Пример #2
0
 public void SetBulletDestroyAction(BulletDestroyAction action)
 {
     bulletDestroyAction = action;
 }
Пример #3
0
    /// <summary>
    /// 총알 초기화함수
    /// </summary>
    /// <param name="startPos">처음위치</param>
    /// <param name="moveDir">발사방향</param>
    /// <param name="moveSpeed">총알속도</param>
    /// <param name="bulletType"></param>
    /// <param name="bulletScale"></param>
    /// <param name="power"></param>
    /// <param name="lifeTime"></param>
    public void Initialize(Vector3 startPos, Vector3 moveDir, float moveSpeed, BulletType bulletType, float bulletScale = 1f, int power = 1, float lifeTime = 5f)
    {
        //위치
        this.transform.position = new Vector3(startPos.x, startPos.y, 0f);

        //이동
        if (rb != null)
        {
            if (TimeManager.Instance.nowUsingScientistSkill == true)
            {
                moveSpeed = moveSpeed + moveSpeed * TimeManager.Instance.slowRatio;
            }

            if (NowSelectPassive.Instance.HasPassive(PassiveType.FlyingBullet) == true)
            {
                bulletSpeed = moveSpeed + 2f;
            }
            else
            {
                bulletSpeed = moveSpeed;
            }

            rb.velocity  = moveDir.normalized * bulletSpeed;
            this.moveDir = moveDir;
        }

        //피아식별
        this.bulletType = bulletType;
        //레이어
        SetLayer(bulletType);
        //크기
        this.transform.localScale = Vector3.one * bulletScale;
        //파워
        this.power = power;

        //애니메이션불렛 유무
        if (animator != null)
        {
            animator.runtimeAnimatorController = null;
        }

        //폭발 타입
        explosionType = ExplosionType.single;

        switch (bulletType)
        {
        case BulletType.EnemyBullet:
        {
            //bloom
            SetBloom(true, Color.red);
        }
        break;

        case BulletType.PlayerBullet:
        {
            //bloom
            SetBloom(true, Color.yellow);
        }
        break;
        }
        StopAllCoroutines();
        StartCoroutine(bulletDestroyRoutine(lifeTime));

        bulletDestroyAction   = BulletDestroyAction.none;
        canDestroyByCollision = true;
        stopWhenCollision     = false;
        explostionEndFunc     = null;
        hasPollute            = false;
    }