예제 #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);
        }
    }
    protected override void OnShow(object userData)
    {
        base.OnShow(userData);

        bulletEffectData = userData as BulletEffectData;
        if (bulletEffectData == null)
        {
            Log.Error("BulletEffect data is invalid.");
            return;
        }

        isStop = false;
        GameEntry.Entity.AttachEntity(Entity, bulletEffectData.OwnerId, AttachPoint, bulletEffectData);
    }