Example #1
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)));
 }
Example #2
0
        public EntityParticleEffect CreateEffectOnEntity(string effectName, EntityBone entityBone, Vector3 off = new Vector3(), Vector3 rot = new Vector3(), float scale = 1f, InvertAxis invertAxis = 0, bool startNow = false)
        {
            EntityParticleEffect effect1 = new EntityParticleEffect(this, effectName, entityBone);

            effect1.Offset     = off;
            effect1.Rotation   = rot;
            effect1.Scale      = scale;
            effect1.InvertAxis = invertAxis;
            EntityParticleEffect effect = effect1;

            if (startNow)
            {
                effect.Start();
            }
            return(effect);
        }
Example #3
0
        public EntityParticleEffect CopyTo(EntityBone entityBone)
        {
            EntityParticleEffect effect1 = new EntityParticleEffect(base._asset, base._effectName, entityBone);

            effect1.Offset     = base._offset;
            effect1.Rotation   = base._rotation;
            effect1.Color      = base._color;
            effect1.Scale      = base._scale;
            effect1.Range      = base._range;
            effect1.InvertAxis = base._InvertAxis;
            EntityParticleEffect effect = effect1;

            if (base.IsActive)
            {
                effect.Start();
            }
            return(effect);
        }
Example #4
0
        /// <summary>
        /// Creates a copy of this <see cref="EntityParticleEffect"/> to another <see cref="GTA.EntityBone"/> to simplify applying the same effect to many Entities.
        /// </summary>
        /// <param name="entityBone">The <see cref="GTA.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="GTA.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);
        }
Example #5
0
        /// <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);
        }
Example #6
0
 public void AttachTo(EntityBone entityBone, Vector3 position = new Vector3(), Vector3 rotation = new Vector3())
 {
     InputArgument[] arguments = new InputArgument[15];
     arguments[0]  = base.Handle;
     arguments[1]  = entityBone.Owner.Handle;
     arguments[2]  = (InputArgument)entityBone;
     arguments[3]  = position.X;
     arguments[4]  = position.Y;
     arguments[5]  = position.Z;
     arguments[6]  = rotation.X;
     arguments[7]  = rotation.Y;
     arguments[8]  = rotation.Z;
     arguments[9]  = 0;
     arguments[10] = 0;
     arguments[11] = 0;
     arguments[12] = 0;
     arguments[13] = 2;
     arguments[14] = 1;
     Function.Call(Hash.ATTACH_ENTITY_TO_ENTITY, arguments);
 }
Example #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));
 }
 public static bool Exists(EntityBone entityBone) =>
 (entityBone != null) && entityBone.IsValid;
 public bool Equals(EntityBone entityBone) =>
 (entityBone != null) && ((this._owner == entityBone._owner) && (this.Index == entityBone.Index));
Example #10
0
 internal EntityParticleEffect(ParticleEffectsAsset asset, string effectName, GTA.Entity entity) : base(asset, effectName)
 {
     this._entityBone = entity.Bones.Core;
 }
Example #11
0
 internal EntityParticleEffect(ParticleEffectsAsset asset, string effectName, EntityBone entitybone) : base(asset, effectName)
 {
     this._entityBone = entitybone;
 }
Example #12
0
 public static bool Exists(EntityBone entityBone) => (object)entityBone != null && entityBone.IsValid;
Example #13
0
 public static bool Exists(EntityBone entityBone)
 {
     return(!ReferenceEquals(entityBone, null) && entityBone.IsValid);
 }
Example #14
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);
 }
Example #15
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);
 }
Example #16
0
 internal ParticleEffect(int handle, string assetName, string effectName, EntityBone entityBone) : base(handle)
 {
     AssetName  = assetName;
     EffectName = effectName;
     Bone       = entityBone;
 }
Example #17
0
 public bool Equals(EntityBone entityBone) => (object)entityBone != null && this._owner == entityBone._owner && this.Index == entityBone.Index;