/// <summary>
 /// Starts a Particle Effect on an <see cref="EntityBone"/> that runs once then is destroyed.
 /// </summary>
 /// <param name="effectName">the name of the effect.</param>
 /// <param name="entityBone">The <see cref="EntityBone"/> the effect is attached to.</param>
 /// <param name="off">The offset from the <paramref name="entityBone"/> to attach the effect.</param>
 /// <param name="rot">The rotation, relative to the <paramref name="entityBone"/>, 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, EntityBone entityBone,
                                    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.StartParticleFxNonLoopedOnPedBone(effectName, entityBone.Owner.Handle, off.X, off.Y, off.Z, rot.X, rot.Y, rot.Z,
                                                  entityBone, scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y), invertAxis.HasFlag(InvertAxis.Z)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Starts a Particle Effect on an <see cref="EntityBone"/> that runs once then is destroyed.
 /// </summary>
 /// <param name="effectName">the name of the effect.</param>
 /// <param name="entityBone">The <see cref="EntityBone"/> the effect is attached to.</param>
 /// <param name="off">The offset from the <paramref name="entityBone"/> to attach the effect.</param>
 /// <param name="rot">The rotation, relative to the <paramref name="entityBone"/>, 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, EntityBone entityBone,
                                    Vector3 off           = default(Vector3), Vector3 rot = default(Vector3), float scale = 1.0f,
                                    InvertAxis invertAxis = InvertAxis.None)
 {
     if (!SetNextCall())
     {
         return(false);
     }
     Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, _assetName);
     return(Function.Call <bool>(Hash.START_PARTICLE_FX_NON_LOOPED_ON_PED_BONE, effectName, entityBone.Owner.Handle, off.X, off.Y, off.Z, rot.X,
                                 rot.Y, rot.Z, entityBone, scale, invertAxis.HasFlag(InvertAxis.X), invertAxis.HasFlag(InvertAxis.Y),
                                 invertAxis.HasFlag(InvertAxis.Z)));
 }
        /// <summary>
        /// Creates a copy of this <see cref="EntityParticleEffect"/> to another <see cref="EntityBone"/> to simplify applying the same effect to many Entities.
        /// </summary>
        /// <param name="entityBone">The <see cref="EntityBone"/> to copy to.</param>
        /// <returns>An <see cref="EntityParticleEffect"/> that has all the same properties as this instance, but for a different <see cref="EntityBone"/>.</returns>
        public EntityParticleEffect CopyTo(EntityBone entityBone)
        {
            var result = new EntityParticleEffect(_asset, _effectName, entityBone)
            {
                Offset     = _offset,
                Rotation   = _rotation,
                Color      = _color,
                Scale      = _scale,
                Range      = _range,
                InvertAxis = _InvertAxis
            };

            if (IsActive)
            {
                result.Start();
            }
            return(result);
        }
        /// <summary>
        /// Creates a <see cref="ParticleEffect"/> on an <see cref="EntityBone"/> that runs looped.
        /// </summary>
        /// <param name="effectName">The name of the Effect</param>
        /// <param name="entityBone">The <see cref="EntityBone"/> the effect is attached to.</param>
        /// <param name="off">The offset from the <paramref name="entityBone"/> to attach the effect.</param>
        /// <param name="rot">The rotation, relative to the <paramref name="entityBone"/>, 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>
        /// <param name="startNow">if <c>true</c> attempt to start this effect now; otherwise, the effect will start when <see cref="ParticleEffect.Start"/> is called.</param>
        /// <returns>The <see cref="EntityParticleEffect"/> represented by this that can be used to start/stop/modify this effect</returns>
        public EntityParticleEffect CreateEffectOnEntity(string effectName, EntityBone entityBone,
                                                         Vector3 off           = default(Vector3), Vector3 rot  = default(Vector3), float scale = 1.0f,
                                                         InvertAxis invertAxis = InvertAxis.None, bool startNow = false)
        {
            var result = new EntityParticleEffect(this, effectName, entityBone)
            {
                Offset     = off,
                Rotation   = rot,
                Scale      = scale,
                InvertAxis = invertAxis
            };

            if (startNow)
            {
                result.Start();
            }
            return(result);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Attaches this <see cref="Entity"/> to a different <see cref="Entity"/>
 /// </summary>
 /// <param name="entityBone">The <see cref="EntityBone"/> to attach this <see cref="Entity"/> to.</param>
 /// <param name="position">The position relative to the <paramref name="entityBone"/> to attach this <see cref="Entity"/> to.</param>
 /// <param name="rotation">The rotation to apply to this <see cref="Entity"/> relative to the <paramref name="entityBone"/></param>
 public void AttachTo(EntityBone entityBone, Vector3 position = default(Vector3), Vector3 rotation = default(Vector3))
 {
     API.AttachEntityToEntity(Handle, entityBone.Owner.Handle, entityBone, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, false, false, false, false, 2, true);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Attaches this <see cref="Entity"/> to a different <see cref="Entity"/>
 /// </summary>
 /// <param name="entityBone">The <see cref="EntityBone"/> to attach this <see cref="Entity"/> to.</param>
 /// <param name="position">The position relative to the <paramref name="entityBone"/> to attach this <see cref="Entity"/> to.</param>
 /// <param name="rotation">The rotation to apply to this <see cref="Entity"/> relative to the <paramref name="entityBone"/></param>
 public void AttachTo(EntityBone entityBone, Vector3 position = default(Vector3), Vector3 rotation = default(Vector3))
 {
     Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY, Handle, entityBone.Owner.Handle, entityBone, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, 0, 0, 0, 0, 2, 1);
 }
 internal EntityParticleEffect(ParticleEffectsAsset asset, string effectName, EntityBone entitybone)
     : base(asset, effectName)
 {
     _entityBone = entitybone;
 }
 internal EntityParticleEffect(ParticleEffectsAsset asset, string effectName, Entity entity)
     : base(asset, effectName)
 {
     _entityBone = entity.Bones.Core;
 }
Ejemplo n.º 9
0
 public static bool Exists(EntityBone entityBone)
 {
     return(!ReferenceEquals(entityBone, null) && entityBone.IsValid);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Checks if two <see cref="EntityBone"/>s refer to the same <see cref="EntityBone"/>
 /// </summary>
 /// <param name="entityBone">The other <see cref="EntityBone"/>.</param>
 /// <returns><c>true</c> if they are the same bone of the same <see cref="Entity"/>; otherwise, false</returns>
 public bool Equals(EntityBone entityBone)
 {
     return(!ReferenceEquals(entityBone, null) && _owner == entityBone._owner && Index == entityBone.Index);
 }