Beispiel #1
0
 public void Init()
 {
     m_bulletShooter   = EBulletShooter.NONE;
     m_bulletType      = EBulletType.NONE;
     m_moveLen         = 0;
     m_targetCharacter = null;
 }
Beispiel #2
0
 public void Init(Vector3 startPos, Vector3 moveVec, float bSpd, float range, EBulletType type, EBulletShooter shooter)
 {
     transform.position = startPos;
     m_moveVec          = moveVec;
     m_bulletSpd        = bSpd;
     m_bulletShooter    = shooter;
     m_bulletRange      = range;
     m_bulletType       = type;
     m_moveLen          = 0;
 }
Beispiel #3
0
    public void Init(Vector3 startPos, Vector3 moveVec, float bSpd, float range, EBulletType type, Transform target, EBulletShooter shooter)
    {
        //유도 or 곡사
        m_targetCharacter = target;

        transform.position = startPos;
        m_moveVec          = moveVec;
        m_bulletSpd        = bSpd;
        m_bulletRange      = range;
        m_bulletShooter    = shooter;
        m_bulletType       = type;
        m_moveLen          = 0;
    }
Beispiel #4
0
    public void Init(Vector3 startPos, Vector3 moveVec, float bSpd, float range, EBulletType type, Vector3 target, EBulletShooter shooter)
    {
        //곡사용
        transform.position = startPos;
        m_moveVec          = moveVec;
        m_bulletSpd        = bSpd;
        m_bulletRange      = range; //곡사일경우 Length비례 Range(총 보간 time)이 정해짐
        m_bulletShooter    = shooter;
        m_bulletType       = type;
        m_moveLen          = 0;

        if (type == EBulletType.CURVE)   //시작지점 조정 추가필요
        {
            Vector3 center = (target + transform.position) / 2f;

            m_moveVec = (target - transform.position);

            m_bulletRange = m_moveVec.magnitude;


            Quaternion rotZAxis  = Quaternion.Euler(0, 0, Random.Range(-80f, 80f));
            Quaternion rotToward = Quaternion.LookRotation(m_moveVec.normalized);


            if (m_curvePoints.Count > 0) //전에 사용된 control point가 있을 경우
            {
                m_curvePoints[0].Set(0f, 0f, -0.5f);
                m_curvePoints[1].Set(0f, 0f, -0.5f);
                m_curvePoints[2].Set(0f, 0f, -0.5f);

                m_curvePoints[3].Set(0f, 0.65f, -0.3f);
                m_curvePoints[4].Set(0f, 0.1f, 0.4f);

                m_curvePoints[5].Set(0f, 0f, 0.5f);
                m_curvePoints[6].Set(0f, 0f, 0.5f);
                m_curvePoints[7].Set(0f, 0f, 0.5f);
            }
            else //없을 경우
            {
                m_curvePoints.Add(new Vector3(0f, 0f, -0.5f));
                m_curvePoints.Add(new Vector3(0f, 0f, -0.5f));
                m_curvePoints.Add(new Vector3(0f, 0f, -0.5f));

                m_curvePoints.Add(new Vector3(0f, 0.25f, -0.3f));
                m_curvePoints.Add(new Vector3(0f, 0.1f, 0.35f));

                m_curvePoints.Add(new Vector3(0f, 0f, 0.5f));
                m_curvePoints.Add(new Vector3(0f, 0f, 0.5f));
                m_curvePoints.Add(new Vector3(0f, 0f, 0.5f));
            }

            for (int i = 0; i < m_curvePoints.Count; i++)
            {
                m_curvePoints[i] *= m_bulletRange;                //scale
                m_curvePoints[i]  = rotZAxis * m_curvePoints[i];  //rotate
                m_curvePoints[i]  = rotToward * m_curvePoints[i]; //rotate
                m_curvePoints[i] += center;                       //translate
            }

            m_curveSegment = 0;
        }
    }