예제 #1
0
    protected override void OnShow(object userData)
    {
        base.OnShow(userData);

        bulletData = userData as BulletData;
        if (bulletData == null)
        {
            Log.Error("Bullet data is invalid.");
            return;
        }

        leftEffectTimes           = 1;
        zeroSpeedAutoDestroyTimes = 0;

        CachedTransform.forward = bulletData.Forward;

        // 让子弹保持水平
        // CachedTransform.forward = new Vector3(
        //     CachedTransform.forward.x,
        //     1,
        //     CachedTransform.forward.z);

        if (bulletData.EffectId > 0)
        {
            BulletEffectData bulletEffectData = new BulletEffectData(EntityExtension.GenerateSerialId(), bulletData.EffectId, Id);
            EntityExtension.ShowBulletEffect(typeof(BulletEffect), "BulletEffectGroup", bulletEffectData);
        }
    }