Exemplo n.º 1
0
 /// <summary>
 /// Starts a Particle Effect on an <see cref="Entity"/> that runs once then is destroyed.
 /// </summary>
 /// <param name="effectName">the name of the effect.</param>
 /// <param name="entity">The <see cref="Entity"/> the effect is attached to.</param>
 /// <param name="off">The offset from the <paramref name="entity"/> to attach the effect.</param>
 /// <param name="rot">The rotation, relative to the <paramref name="entity"/>, the effect has.</param>
 /// <param name="scale">How much to scale the size of the effect by.</param>
 /// <param name="invertAxis">Which axis to flip the effect in. For a car side exahust you may need to flip in the Y Axis</param>
 /// <returns><c>true</c>If the effect was able to start; otherwise, <c>false</c>.</returns>
 public bool StartNonLoopedOnEntity(string effectName, Entity entity, Vector3 off = default(Vector3), Vector3 rot = default(Vector3), float scale = 1.0f, InvertAxis invertAxis = InvertAxis.None)
 {
     if (!SetNextCall())
     {
         return(false);
     }
     Function.Call(Hash._USE_PARTICLE_FX_ASSET_NEXT_CALL, _assetName);
     return(Function.Call <bool>(Hash.START_PARTICLE_FX_NON_LOOPED_ON_PED_BONE, effectName, entity.Handle, off.X, off.Y, off.Z, rot.X,
                                 rot.Y, rot.Z, -1, scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y),
                                 invertAxis.HasFlag(InvertAxis.Z)));
 }
        /// <summary>
        /// Starts this <see cref="EntityParticleEffect"/>.
        /// </summary>
        /// <returns><c>true</c> if this <see cref="EntityParticleEffect"/> was sucessfully started; otherwise, <c>false</c>.</returns>
        public override bool Start()
        {
            Stop();

            if (!_asset.SetNextCall())
            {
                return(false);
            }

            if (_entityBone.Owner is Ped)
            {
                Handle = API.StartParticleFxLoopedOnPedBone(_effectName, _entityBone.Owner.Handle, Offset.X, Offset.Y, Offset.Z,
                                                            Rotation.X, Rotation.Y, Rotation.Z, _entityBone.Index, _scale, InvertAxis.HasFlag(InvertAxis.X),
                                                            InvertAxis.HasFlag(InvertAxis.Y), InvertAxis.HasFlag(InvertAxis.Z));
            }
            else
            {
                Handle = API.StartParticleFxLoopedOnEntityBone(_effectName, _entityBone.Owner.Handle, Offset.X, Offset.Y, Offset.Z,
                                                               Rotation.X, Rotation.Y, Rotation.Z, _entityBone.Index, _scale, InvertAxis.HasFlag(InvertAxis.X),
                                                               InvertAxis.HasFlag(InvertAxis.Y), InvertAxis.HasFlag(InvertAxis.Z));
            }

            if (IsActive)
            {
                return(true);
            }

            Handle = -1;
            return(false);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Starts a Particle Effect that runs once at a given position then is destroyed.
 /// </summary>
 /// <param name="effectName">The name of the effect.</param>
 /// <param name="pos">The World position where the effect is.</param>
 /// <param name="rot">What rotation to apply to the effect.</param>
 /// <param name="scale">How much to scale the size of the effect by.</param>
 /// <param name="invertAxis">Which axis to flip the effect in.</param>
 /// <returns><c>true</c>If the effect was able to start; otherwise, <c>false</c>.</returns>
 public bool StartNonLoopedAtCoord(string effectName, Vector3 pos, Vector3 rot = default(Vector3), float scale = 1.0f, InvertAxis invertAxis = InvertAxis.None)
 {
     if (!SetNextCall())
     {
         return(false);
     }
     Function.Call(Hash._USE_PARTICLE_FX_ASSET_NEXT_CALL, _assetName);
     return(Function.Call <bool>(Hash.START_PARTICLE_FX_NON_LOOPED_AT_COORD, effectName, pos.X, pos.Y, pos.Z, rot.X, rot.Y,
                                 rot.Z, scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y), invertAxis.HasFlag(InvertAxis.Z)));
 }
 /// <summary>
 /// Starts a Particle Effect that runs once at a given position then is destroyed.
 /// </summary>
 /// <param name="effectName">The name of the effect.</param>
 /// <param name="pos">The World position where the effect is.</param>
 /// <param name="rot">What rotation to apply to the effect.</param>
 /// <param name="scale">How much to scale the size of the effect by.</param>
 /// <param name="invertAxis">Which axis to flip the effect in.</param>
 /// <returns><c>true</c>If the effect was able to start; otherwise, <c>false</c>.</returns>
 public bool StartNonLoopedAtCoord(string effectName, Vector3 pos, Vector3 rot = default(Vector3), float scale = 1.0f,
                                   InvertAxis invertAxis = InvertAxis.None)
 {
     if (!SetNextCall())
     {
         return(false);
     }
     API.SetPtfxAssetNextCall(_assetName);
     return(API.StartParticleFxNonLoopedAtCoord(effectName, pos.X, pos.Y, pos.Z, rot.X, rot.Y, rot.Z,
                                                scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y), invertAxis.HasFlag(InvertAxis.Z)) > 0);
 }
 /// <summary>
 /// Starts a Particle Effect on an <see cref="Entity"/> that runs once then is destroyed.
 /// </summary>
 /// <param name="effectName">the name of the effect.</param>
 /// <param name="entity">The <see cref="Entity"/> the effect is attached to.</param>
 /// <param name="off">The offset from the <paramref name="entity"/> to attach the effect.</param>
 /// <param name="rot">The rotation, relative to the <paramref name="entity"/>, the effect has.</param>
 /// <param name="scale">How much to scale the size of the effect by.</param>
 /// <param name="invertAxis">Which axis to flip the effect in. For a car side exahust you may need to flip in the Y Axis</param>
 /// <returns><c>true</c>If the effect was able to start; otherwise, <c>false</c>.</returns>
 public bool StartNonLoopedOnEntity(string effectName, Entity entity,
                                    Vector3 off           = default(Vector3), Vector3 rot = default(Vector3), float scale = 1.0f,
                                    InvertAxis invertAxis = InvertAxis.None)
 {
     if (!SetNextCall())
     {
         return(false);
     }
     API.SetPtfxAssetNextCall(_assetName);
     return(API.StartParticleFxNonLoopedOnEntity(effectName, entity.Handle, off.X, off.Y, off.Z, rot.X, rot.Y, rot.Z,
                                                 scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y), invertAxis.HasFlag(InvertAxis.Z)));
 }
Exemplo n.º 6
0
 public bool StartNonLoopedAtCoord(string effectName, Vector3 pos, Vector3 rot = new Vector3(), float scale = 1f, InvertAxis invertAxis = 0)
 {
     if (!this.SetNextCall())
     {
         return(false);
     }
     InputArgument[] arguments = new InputArgument[] { this._assetName };
     Function.Call(Hash._USE_PARTICLE_FX_ASSET_NEXT_CALL, arguments);
     InputArgument[] argumentArray2 = new InputArgument[11];
     argumentArray2[0]  = effectName;
     argumentArray2[1]  = pos.X;
     argumentArray2[2]  = pos.Y;
     argumentArray2[3]  = pos.Z;
     argumentArray2[4]  = rot.X;
     argumentArray2[5]  = rot.Y;
     argumentArray2[6]  = rot.Z;
     argumentArray2[7]  = scale;
     argumentArray2[8]  = invertAxis.HasFlag(InvertAxis.X);
     argumentArray2[9]  = invertAxis.HasFlag(InvertAxis.Y);
     argumentArray2[10] = invertAxis.HasFlag(InvertAxis.Z);
     return(Function.Call <bool>(Hash.START_PARTICLE_FX_NON_LOOPED_AT_COORD, argumentArray2));
 }
Exemplo n.º 7
0
 public bool StartNonLoopedOnEntity(string effectName, EntityBone entityBone, Vector3 off = new Vector3(), Vector3 rot = new Vector3(), float scale = 1f, InvertAxis invertAxis = 0)
 {
     if (!this.SetNextCall())
     {
         return(false);
     }
     InputArgument[] arguments = new InputArgument[] { this._assetName };
     Function.Call(Hash._USE_PARTICLE_FX_ASSET_NEXT_CALL, arguments);
     InputArgument[] argumentArray2 = new InputArgument[13];
     argumentArray2[0]  = effectName;
     argumentArray2[1]  = entityBone.Owner.Handle;
     argumentArray2[2]  = off.X;
     argumentArray2[3]  = off.Y;
     argumentArray2[4]  = off.Z;
     argumentArray2[5]  = rot.X;
     argumentArray2[6]  = rot.Y;
     argumentArray2[7]  = rot.Z;
     argumentArray2[8]  = (InputArgument)entityBone;
     argumentArray2[9]  = scale;
     argumentArray2[10] = invertAxis.HasFlag(InvertAxis.X);
     argumentArray2[11] = invertAxis.HasFlag(InvertAxis.Y);
     argumentArray2[12] = invertAxis.HasFlag(InvertAxis.Z);
     return(Function.Call <bool>(Hash.START_PARTICLE_FX_NON_LOOPED_ON_PED_BONE, argumentArray2));
 }
Exemplo n.º 8
0
        /// <summary>
        /// Starts this <see cref="CoordinateParticleEffect"/>.
        /// </summary>
        /// <returns><c>true</c> if this <see cref="CoordinateParticleEffect"/> was sucessfully started; otherwise, <c>false</c>.</returns>
        public override bool Start()
        {
            Stop();
            if (!_asset.SetNextCall())
            {
                return(false);
            }

            Handle = Function.Call <int>(Hash.START_PARTICLE_FX_LOOPED_AT_COORD, _effectName, Offset.X, Offset.Y, Offset.Z, Rotation.X,
                                         Rotation.Y, Rotation.Z, Scale, InvertAxis.HasFlag(InvertAxis.X), InvertAxis.HasFlag(InvertAxis.Y),
                                         InvertAxis.HasFlag(InvertAxis.Z), false);

            if (IsActive)
            {
                return(true);
            }

            Handle = -1;
            return(false);
        }
        /// <summary>
        /// Starts this <see cref="CoordinateParticleEffect"/>.
        /// </summary>
        /// <returns><c>true</c> if this <see cref="CoordinateParticleEffect"/> was sucessfully started; otherwise, <c>false</c>.</returns>
        public override bool Start()
        {
            Stop();
            if (!_asset.SetNextCall())
            {
                return(false);
            }

            Handle = API.StartParticleFxLoopedAtCoord(_effectName, Offset.X, Offset.Y, Offset.Z, Rotation.X,
                                                      Rotation.Y, Rotation.Z, Scale, InvertAxis.HasFlag(InvertAxis.X), InvertAxis.HasFlag(InvertAxis.Y),
                                                      InvertAxis.HasFlag(InvertAxis.Z), false);

            if (IsActive)
            {
                return(true);
            }

            Handle = -1;
            return(false);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Starts this <see cref="EntityParticleEffect"/>.
        /// </summary>
        /// <returns><c>true</c> if this <see cref="EntityParticleEffect"/> was sucessfully started; otherwise, <c>false</c>.</returns>
        public override bool Start()
        {
            Stop();
            if (!_asset.SetNextCall())
            {
                return(false);
            }

            Hash hash = _entityBone.Owner is Ped ? Hash.START_PARTICLE_FX_LOOPED_ON_PED_BONE : Hash._START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE;

            Handle = Function.Call <int>(hash, _effectName, _entityBone.Owner.Handle, Offset.X, Offset.Y, Offset.Z, Rotation.X,
                                         Rotation.Y, Rotation.Z, _entityBone.Index, _scale, InvertAxis.HasFlag(InvertAxis.X), InvertAxis.HasFlag(InvertAxis.Y),
                                         InvertAxis.HasFlag(InvertAxis.Z));

            if (IsActive)
            {
                return(true);
            }

            Handle = -1;
            return(false);
        }