Beispiel #1
0
 public SingleBulletLauncher(BulletLauncherDataBase data, GameObject gameObject, BulletBase tempBullet)
     : base(EBulletLauncherType.SingleBullet)
 {
     m_data           = data as SingleBulletLauncherData;
     m_bullets        = new List <SingleBullet>();
     m_cacheBullets   = new List <SingleBullet>();
     m_templateBullet = tempBullet as SingleBullet;
     m_templateBullet.gameObject.SetActive(false);
     m_bulletNode = ObjectCommon.GetChildComponent <Transform>(gameObject, "bullet_node");
     if (m_data == null)
     {
         Debug.LogError("SingleBulletLauncherData parse error!!");
     }
 }
    public static BulletLauncherDataBase CreateBulletLauncherData(EBulletLauncherType type)
    {
        BulletLauncherDataBase data = null;

        switch (type)
        {
        case EBulletLauncherType.SingleBullet:
            data = new SingleBulletLauncherData();
            break;

        case EBulletLauncherType.Laser:
            break;
        }

        return(data);
    }
    public override void BulletAwake(Transform transform, Vector3 direction, BulletLauncherDataBase data)
    {
        m_launcherData = data as SingleBulletLauncherData;
        if (m_launcherData == null)
        {
            Debug.LogError("SingleBulletLauncher is null !!!");
            return;
        }
        m_direction             = direction;
        this.transform.position = transform.position;
        this.transform.rotation = transform.rotation;
        m_deadTime = Time.time + m_launcherData.m_lifeTime;
        gameObject.SetActive(true);
        m_animator.Play(m_launcherData.m_fireAnimName);
        m_isAwake = true;

        if (m_waitForSeconds == null)
        {
            m_waitForSeconds = new WaitForSeconds(m_launcherData.m_fadeBulletTime);
        }
    }