示例#1
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);
        }
示例#3
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);
        }
示例#4
0
 public void SetInvertAxis(InvertAxis axisToUse, bool value)
 {
     if (axisToUse == InvertAxis.InvertCameraX)
     {
         InvertCameraX = value;
         PlayerPrefs.SetInt("InvertCameraX", (value ? 1:0));
     }
     else if (axisToUse == InvertAxis.InvertCameraY)
     {
         InvertCameraY = value;
         PlayerPrefs.SetInt("InvertCameraY", (value ? 1:0));
     }
     else if (axisToUse == InvertAxis.InvertMovementX)
     {
         InvertMovementX = value;
         PlayerPrefs.SetInt("InvertMovementX", (value ? 1:0));
     }
     else if (axisToUse == InvertAxis.InvertMovementY)
     {
         InvertMovementY = value;
         PlayerPrefs.SetInt("InvertMovementY", (value ? 1:0));
     }
 }
示例#5
0
 public bool GetInvertAxis(InvertAxis axisToUse)
 {
     if (axisToUse == InvertAxis.InvertCameraX)
     {
         InvertCameraX = PlayerPrefs.GetInt("InvertCameraX") == 1;
         return(PlayerPrefs.GetInt("InvertCameraX") == 1);
     }
     else if (axisToUse == InvertAxis.InvertCameraY)
     {
         InvertCameraY = PlayerPrefs.GetInt("InvertCameraY") == 1;
         return(PlayerPrefs.GetInt("InvertCameraY") == 1);
     }
     else if (axisToUse == InvertAxis.InvertMovementX)
     {
         InvertMovementX = PlayerPrefs.GetInt("InvertMovementX") == 1;
         return(PlayerPrefs.GetInt("InvertMovementX") == 1);
     }
     else if (axisToUse == InvertAxis.InvertMovementY)
     {
         InvertMovementY = PlayerPrefs.GetInt("InvertMovementY") == 1;
         return(PlayerPrefs.GetInt("InvertMovementY") == 1);
     }
     return(false);
 }
示例#6
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)));
 }
示例#7
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)));
 }
示例#8
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);
        }
示例#9
0
        public CoordinateParticleEffect CreateEffectAtCoord(string effectName, Vector3 pos, Vector3 rot = new Vector3(), float scale = 1f, InvertAxis invertAxis = 0, bool startNow = false)
        {
            CoordinateParticleEffect effect1 = new CoordinateParticleEffect(this, effectName, pos);

            effect1.Rotation   = rot;
            effect1.Scale      = scale;
            effect1.InvertAxis = invertAxis;
            CoordinateParticleEffect effect = effect1;

            if (startNow)
            {
                effect.Start();
            }
            return(effect);
        }
示例#10
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));
 }
示例#11
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));
 }
        /// <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);
        }