コード例 #1
0
        public void CreateMirroredDecal(float timeInSeconds = -1f)
        {
            Vector3 dir;
            float   rotAngle = 0f;

            switch (MirrorFlip)
            {
            case GraffitiMethods.MirrorFlip.Mirror:
                rotAngle = RotationAngle - ((RotationAngle - 180f) * 2f);
                break;

            case GraffitiMethods.MirrorFlip.Mirror2:
                rotAngle = (RotationAngle - ((RotationAngle - 180f) * 2f)) - 180f;
                break;

            case GraffitiMethods.MirrorFlip.Flip:
                rotAngle = RotationAngle - 180f;
                break;

            case GraffitiMethods.MirrorFlip.Flip2:
                rotAngle = RotationAngle;
                break;
            }

            Vector3 pos = GetMirroredPos(out dir);

            MirroredHandle = DecalHelper.AddDecalTexture(TaggedVehicle.GetOffsetInWorldCoords(pos), dir, rotAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, RGB_Red, RGB_Green, RGB_Blue, RGB_Alpha, timeInSeconds, true, TaggedVehicle);
        }
コード例 #2
0
        public override void CreateDecal(float timeInSeconds = -1f)
        {
            if (GraffitiOG.LoadedCount > 0 || GraffitiMethods.AvailableDecalTypeExists())
            {
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiOG.LoadedCount    = 0; // Just in case it some how goes negative..
                    GraffitiOG.DecalTypeIndex = GraffitiMethods.NextAvailableDecalType();
                }

                if (!DecalTypeIndexIsValid())
                {
                    return;
                }

                GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = false;
                Handle = DecalHelper.AddDecalTexture(Location, Direction, RotationAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, 255f, 255f, 255f, 255f, timeInSeconds);

                if (Exists() && !isCounted)
                {
                    GraffitiOG.LoadedCount++;
                    isCounted = true;
                }
            }
            else
            {
                UI.ShowSubtitle("There are too many decals in this area!\nSome will not display.", 1);
            }
        }
コード例 #3
0
        public override void CreateDecal(float timeInSeconds = -1f)
        {
            if (GraffitiOG.LoadedCount > 0 || GraffitiMethods.AvailableDecalTypeExists())
            {
                if (GraffitiOG.LoadedCount < 1)
                {
                    GraffitiOG.LoadedCount    = 0; // Just in case it some how goes negative..
                    GraffitiOG.DecalTypeIndex = GraffitiMethods.NextAvailableDecalType();
                }

                if (!DecalTypeIndexIsValid())
                {
                    return;
                }

                GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].Available = false;
                Handle = DecalHelper.AddDecalTexture(TaggedVehicle.GetOffsetInWorldCoords(Location), Direction, RotationAngle, GraffitiOG.TextureDictionary, GraffitiOG.TextureName, GraffitiMethods.UsableDecalTypes[GraffitiOG.DecalTypeIndex].DecalTypeID, DisplayWidth, DisplayHeight, RGB_Red, RGB_Green, RGB_Blue, RGB_Alpha, timeInSeconds, true, TaggedVehicle);

                if (MirrorFlip != GraffitiMethods.MirrorFlip.None)
                {
                    CreateMirroredDecal(timeInSeconds);
                }

                if (Exists() && !isCounted)
                {
                    GraffitiOG.LoadedCount++;
                    isCounted = true;
                }
            }
            else
            {
                UI.ShowSubtitle("There are too many decals in this area!\nSome will not display.", 1);
            }
        }
コード例 #4
0
        public static bool DisplayTemporaryGraffiti()
        {
            if (UsableDecalTypes.Any(d => d.Available)) //((LastHitDecalTypeIndex != -1 && UsableDecalTypes[LastHitDecalTypeIndex].Available) || NextAvailableDecalType(out LastHitDecalTypeIndex))
            {
                RaycastResult ray = World.Raycast(GameplayCamera.Position, GameplayCamera.Position + GameplayCamera.Direction * 2000, IntersectOptions.Map | IntersectOptions.Mission_Entities | IntersectOptions.Objects, Game.Player.Character);

                //int handle = TextureClasses.AddDecalTexture(ray.HitCoords, -ray.SurfaceNormal, new Vector3(unkX, unkY, unkZ).Normalized, "graffiti", "black_angel_wings", TextureClasses.DecalTypes.solidPool_oil, 3.84f, 3.555f, 255f, 255f, 255f, 255f, 0.5f);

                //Vector2 temp = MathHelper.PointOnCircle(1f, RotationAngle, new Vector2(0f, 0f));
                //Vector3 unkVec3 = Quaternion.FromToRotation(-ray.SurfaceNormal, -ray.SurfaceNormal) * new Vector3(temp.Y, temp.X, 0f);
                //Vector3 unkVec3 = Quaternion.RotationAxis(-ray.SurfaceNormal, MathUtil.DegreesToRadians(RotationAngle)) * new Vector3(1f, 1f, 1f);

                Vector2 grafSize = ResizedWidthHeightBasedOnNewWidth(LastSelectedGraffiti.TextureWidth, LastSelectedGraffiti.TextureHeight, 2f, WidthHeightSizeCoeff);

                LastHitLocation      = ray.HitCoords;
                LastHitDirection     = -ray.SurfaceNormal;
                LastHitRotationAngle = RotationAngle;
                LastHitGrafSize      = grafSize;

                if (ray.DitHitEntity && GTAVFunctions.GTAFunction.EntityIsAVehicle(ray.HitEntity))
                {
                    LastHitVehicle = (Vehicle)ray.HitEntity;
                }
                else
                {
                    LastHitVehicle = null;
                }

                int handle = DecalHelper.AddDecalTexture(ray.HitCoords, -ray.SurfaceNormal, RotationAngle, LastSelectedGraffiti.TextureDictionary, LastSelectedGraffiti.TextureName, 9007, grafSize.X, grafSize.Y, 255f, 255f, 255f, 255f, 0.5f, true, LastHitVehicle);

                /*UI.ShowSubtitle(
                 *  "Angle: " + RotationAngle
                 + "~n~SurfaceNormal: " + -ray.SurfaceNormal
                 +  , 1);*/
                return(true);
            }
            else
            {
                UI.ShowSubtitle("Too many decals nearby!\nYou cannot place anymore here.", 1);
                return(false);
            }
        }