示例#1
0
        /// <summary>
        /// Gets the <see cref="Entity"/> this <see cref="Player"/> is targetting.
        /// </summary>
        /// <returns>The <see cref="Entity"/> if this <see cref="Player"/> is targetting any <see cref="Entity"/>; otherwise, <c>null</c></returns>
        public Entity GetTargetedEntity()
        {
            int entityHandle;

            unsafe
            {
                if (Function.Call <bool>(Hash.GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, Handle, &entityHandle))
                {
                    return(Entity.FromHandle(entityHandle));
                }
            }
            return(null);
        }
示例#2
0
        public RaycastResult(int handle) : this()
        {
            var hitPositionArg   = new OutputArgument();
            var hitSomethingArg  = new OutputArgument();
            var entityHandleArg  = new OutputArgument();
            var surfaceNormalArg = new OutputArgument();

            Result = Function.Call <int>(Hash._GET_RAYCAST_RESULT, handle, hitSomethingArg, hitPositionArg, surfaceNormalArg, entityHandleArg);

            DitHit        = hitSomethingArg.GetResult <bool>();
            HitPosition   = hitPositionArg.GetResult <Vector3>();
            SurfaceNormal = surfaceNormalArg.GetResult <Vector3>();
            HitEntity     = Entity.FromHandle(entityHandleArg.GetResult <int>());
        }
        public unsafe RaycastResult(int handle)
            : this()
        {
            bool          flag;
            NativeVector3 nativeVector3_1;
            NativeVector3 nativeVector3_2;
            int           handle1;

            this.Result        = Function.Call <int>(Hash.GET_SHAPE_TEST_RESULT, (InputArgument)handle, (InputArgument)(void *)&flag, (InputArgument)(void *)&nativeVector3_1, (InputArgument)(void *)&nativeVector3_2, (InputArgument)(void *)&handle1);
            this.DitHit        = flag;
            this.HitPosition   = (Vector3)nativeVector3_1;
            this.SurfaceNormal = (Vector3)nativeVector3_2;
            this.HitEntity     = Entity.FromHandle(handle1);
        }
        public unsafe RaycastResult(int handle)
        {
            int           num;
            NativeVector3 vector;
            NativeVector3 vector2;
            bool          flag;

            this = new RaycastResult();
            InputArgument[] arguments = new InputArgument[] { handle, (IntPtr) & flag, (IntPtr) & vector2, (IntPtr) & vector, (IntPtr) & num };
            this.Result        = Function.Call <int>(Hash.GET_SHAPE_TEST_RESULT, arguments);
            this.DitHit        = flag;
            this.HitPosition   = (Vector3)vector2;
            this.SurfaceNormal = (Vector3)vector;
            this.HitEntity     = Entity.FromHandle(num);
        }
示例#5
0
        internal RaycastResult(int handle)
        {
            int hitSomething;
            int entityHandle;
            var hitCoords     = new OutputArgument();
            var surfaceNormal = new OutputArgument();

            unsafe
            {
                Result = Function.Call <int>(Hash._GET_RAYCAST_RESULT, handle, &hitSomething, hitCoords, surfaceNormal, &entityHandle);
            }

            DidHit        = hitSomething != 0;
            HitEntity     = Entity.FromHandle(entityHandle);
            HitCoords     = hitCoords.GetResult <Vector3>();
            SurfaceNormal = surfaceNormal.GetResult <Vector3>();
        }
示例#6
0
        public RaycastResult(int handle) : this()
        {
            NativeVector3 hitPositionArg;
            bool          hitSomethingArg;
            int           entityHandleArg;
            NativeVector3 surfaceNormalArg;

            unsafe
            {
                Result = Function.Call <int>(Hash.GET_SHAPE_TEST_RESULT, handle, &hitSomethingArg, &hitPositionArg, &surfaceNormalArg, &entityHandleArg);
            }

            DidHit        = hitSomethingArg;
            HitPosition   = hitPositionArg;
            SurfaceNormal = surfaceNormalArg;
            HitEntity     = Entity.FromHandle(entityHandleArg);
        }
示例#7
0
 public Entity GetKiller()
 {
     return(Entity.FromHandle(Function.Call <int>(Hash.GET_PED_SOURCE_OF_DEATH, Handle)));
 }
示例#8
0
文件: Ped.cs 项目: Rbn3D/SHVDNPro
 public Entity GetKiller()
 {
     return(Entity.FromHandle(Function.Call <int>(Hash._GET_PED_KILLER, Handle)));
 }
示例#9
0
        public unsafe Entity GetTargetedEntity()
        {
            int num;

            InputArgument[] arguments = new InputArgument[] { this.Handle, (IntPtr) & num };
            return(!Function.Call <bool>(Hash.GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, arguments) ? null : Entity.FromHandle(num));
        }