Beispiel #1
0
        public CGrenade(Vector3 startPos, Vector3 startDirection, EBombType bombType, EExplosionType exType, int bombTickInterval, int grenadeTickInterval)
        {
            this.startDir = startDirection;

            this.bomb = new CBomb(
                                  startPos,
                                  "CJ_PROP_GRENADE",
                                  EBombType.payload,
                                  exType,
                                  bombTickInterval);

            this.timer = new GTA.Timer();
            this.timer.Interval = grenadeTickInterval;
            this.timer.Start();
            this.timer.Tick += new EventHandler(timer_Tick);

            this.bomb.Obj.Collision = true;
            this.bomb.Obj.SetRecordCollisions(true);

            this.ptfxHandle = GTA.Native.Function.Call<int>("START_PTFX_ON_OBJ", "weap_molotov_smoke", this.bomb.Obj, 0.125, -0.02, 0.01, 0.0, 0.0, 0.0, 1.1);

            this.bomb.Obj.FreezePosition = false;
            this.bomb.Obj.Rotation = GTA.Helper.DirectionToRotation(startDirection, 0f);
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CRocket"/> class.
        /// </summary>
        /// <param name="startPos">The start position.</param>
        /// <param name="startDirection">The start direction.</param>
        /// <param name="bombType">Type of payload.</param>
        /// <param name="exType">Type of explosion.</param>
        /// <param name="bombTickInterval">The bomb tick interval.</param>
        /// <param name="rocketTickInterval">The rocket tick interval.</param>
        public CRocket(Vector3 startPos, Vector3 startDirection, EBombType bombType, EExplosionType exType, int bombTickInterval, int rocketTickInterval)
        {
            this.bomb = new CBomb(
                                  startPos,
                                  "cj_rpg_rocket",
                                  EBombType.payload,
                                  exType,
                                  bombTickInterval);

            this.timer = new GTA.Timer();
            this.timer.Interval = rocketTickInterval;
            this.timer.Start();
            this.timer.Tick += new EventHandler(this.timer_Tick);

            this.vel = GParams.RocketVel;

            // Example...
            //START_PTFX_ON_OBJ("ambient_cig_smoke", c.a, 0.125, -0.02, 0.01, 0.0, 0.0, 0.0, 1.1) --+z-y+x
            this.ptfxHandle = GTA.Native.Function.Call<int>("START_PTFX_ON_OBJ", "weap_rocket_player", this.bomb.Obj, 0.125, -0.02, 0.01, 0.0, 0.0, 0.0, 1.1);

            this.light = new GTA.Light(System.Drawing.Color.Orange, 15.0f, 80f);
            this.light.Position = this.bomb.Obj.GetOffsetPosition(new Vector3(0f, -2f, 0f));
            this.light.Enabled = true;
        }