Beispiel #1
0
        public static bool FixLegacyBezierData(GameObject imageObject)
        {
            Component iWarpComponent = imageObject.GetComponent(typeof(IWarp));

            if (iWarpComponent != null)
            {
                IWarp iWarp = iWarpComponent as IWarp;

                iWarp.topBezierHandleA -= iWarp.cornerOffsetTL;
                iWarp.topBezierHandleB -= iWarp.cornerOffsetTR;

                iWarp.bottomBezierHandleA -= iWarp.cornerOffsetBR;
                iWarp.bottomBezierHandleB -= iWarp.cornerOffsetBL;

                iWarp.leftBezierHandleA -= iWarp.cornerOffsetBL;
                iWarp.leftBezierHandleB -= iWarp.cornerOffsetTL;

                iWarp.rightBezierHandleA -= iWarp.cornerOffsetTR;
                iWarp.rightBezierHandleB -= iWarp.cornerOffsetBR;
            }
            else
            {
                Debug.Log("No ImageWarp component found. Make sure you have the desired GameObject selected.");
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private void HandleWalkToWarpTile(IWarp warp)
        {
            if (warp.DoorType != DoorSpec.NoDoor)
            {
                if (!_unlockDoorValidator.CanMainCharacterOpenDoor(warp))
                {
                    var requiredKey = _unlockDoorValidator.GetRequiredKey(warp);

                    var messageBox = _eoMessageBoxFactory.CreateMessageBox(DialogResourceID.DOOR_LOCKED);
                    messageBox.ShowDialog();
                    _statusLabelSetter.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING,
                                                      EOResourceID.STATUS_LABEL_THE_DOOR_IS_LOCKED_EXCLAMATION,
                                                      " - " + requiredKey);
                }
                else if (!_currentMapStateRepository.OpenDoors.Contains(warp) &&
                         !_currentMapStateRepository.PendingDoors.Contains(warp))
                {
                    var packet = new PacketBuilder(PacketFamily.Door, PacketAction.Open)
                                 .AddChar((byte)warp.X)
                                 .AddChar((byte)warp.Y)
                                 .Build();

                    _packetSendService.SendPacket(packet);
                    _currentMapStateRepository.PendingDoors.Add(warp);
                }
            }
            else if (warp.LevelRequirement > 0 && MainCharacter.Stats[CharacterStat.Level] < warp.LevelRequirement)
            {
                _statusLabelSetter.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_WARNING,
                                                  EOResourceID.STATUS_LABEL_NOT_READY_TO_USE_ENTRANCE,
                                                  " - LVL " + warp.LevelRequirement);
            }
        }
        public bool CanMainCharacterOpenDoor(IWarp warp)
        {
            var itemName = GetRequiredKey(warp);

            return(!itemName.HasValue || _characterInventoryProvider.ItemInventory
                   .Select(x => _eifFileProvider.EIFFile[x.ItemID].Name)
                   .Any(x => string.Compare(x, itemName, StringComparison.InvariantCultureIgnoreCase) == 0));
        }
Beispiel #4
0
    // Start is called before the first frame update
    void Start()
    {
        gameManager = GameObject.Find("_SCRIPTS_").GetComponentInChildren <GameManager>();
        playerPOV   = GetComponentInChildren <Camera>();
        playerHUD   = GameObject.Find("Menues").transform.Find("PlayerHud").GetComponent <PlayerHUDManager>();
        playerHUD.SetupCameras(GetComponentInChildren <Camera>());

        warpManager   = GetComponent <Warp>();
        weaponManager = GetComponent <WeaponManager>();
    }
        public Optional <string> GetRequiredKey(IWarp warp)
        {
            switch (warp.DoorType)
            {
            case DoorSpec.LockedSilver: return("Silver Key");

            case DoorSpec.LockedCrystal: return("Crystal Key");

            case DoorSpec.LockedWraith: return("Wraith Key");

            default: return(Optional <string> .Empty);
            }
        }
 private bool IsWarpWalkable(IWarp warp, TileSpec tile)
 {
     if (warp.DoorType != DoorSpec.NoDoor)
     {
         return(_currentMapStateProvider.OpenDoors.Any(w => w.X == warp.X && w.Y == warp.Y) &&
                _unlockDoorValidator.CanMainCharacterOpenDoor(warp));
     }
     if (warp.LevelRequirement != 0)
     {
         return(warp.LevelRequirement <= _characterProvider.MainCharacter.Stats[CharacterStat.Level]);
     }
     return(IsTileSpecWalkable(tile));
 }
Beispiel #7
0
        private void rewarp()
        {
            if (inputImage == null)
            {
                return;
            }

            IWarp  warp = functions[comboFunction.SelectedIndex];
            double fact = (double)numericFactor.Value;

            warp.Factor = fact;

            Bitmap newImage;

            Warping.WarpImage(inputImage, out newImage, warp);

            setImage(ref outputImage, newImage);
        }
Beispiel #8
0
        public void TempWarp(IWarp warp)
        {
            void FadeToTransitionEnded()
            {
                Obj player = PlayerObj.Player;

                player.Warp(warp);
                void FadeFromTransitionEnded()
                {
                    _fadeFromTransition = null;
                }

                _fadeFromTransition = new FadeFromColorTransition(20, 0, FadeFromTransitionEnded);
                if (player.QueuedScriptMovements.Count > 0)
                {
                    player.RunNextScriptMovement();
                }
                _fadeToTransition = null;
            }

            _fadeToTransition = new FadeToColorTransition(20, 0, FadeToTransitionEnded);
        }
Beispiel #9
0
        public static void WarpImage(Bitmap input, out Bitmap output, IWarp warp)
        {
            // !!!{{ TODO: write your own warping algorithm here

            int width = input.Width;
            int height = input.Height;
            int owidth, oheight;

            warp.OutputSize(width, height, out owidth, out oheight);
            output = new Bitmap(owidth, oheight, PixelFormat.Format24bppRgb);
            for (int y = 0; y < oheight; y++)
            {
                for (int x = 0; x < owidth; x++)
                {
                    double xd, yd;
                    warp.FInv((double)x, (double)y, out xd, out yd);
                    if (xd < 0.0)
                    {
                        xd = 0.0;
                    }
                    if (xd > width - 1.0)
                    {
                        xd = width - 1.0;
                    }
                    if (yd < 0.0)
                    {
                        yd = 0.0;
                    }
                    if (yd > height - 1.0)
                    {
                        yd = height - 1.0;
                    }
                    Color col = input.GetPixel((int)xd, (int)yd);
                    output.SetPixel(x, y, col);
                }
            }

            // !!!}}
        }
Beispiel #10
0
        public static void WarpImage( Bitmap input, out Bitmap output, IWarp warp )
        {
            // !!!{{ TODO: write your own warping algorithm here

              int width  = input.Width;
              int height = input.Height;
              int owidth, oheight;
              warp.OutputSize( width, height, out owidth, out oheight );
              output = new Bitmap( owidth, oheight, System.Drawing.Imaging.PixelFormat.Format24bppRgb );
              for ( int y = 0; y < oheight; y++ )
            for ( int x = 0; x < owidth; x++ )
            {
              double xd, yd;
              warp.FInv( (double)x, (double)y, out xd, out yd );
              if ( xd < 0.0 ) xd = 0.0;
              if ( xd > width - 1.0 ) xd = width - 1.0;
              if ( yd < 0.0 ) yd = 0.0;
              if ( yd > height - 1.0 ) yd = height - 1.0;
              Color col = input.GetPixel( (int)xd, (int)yd );
              output.SetPixel( x, y, col );
            }

              // !!!}}
        }
Beispiel #11
0
        public void Warp(IWarp warp)
        {
            var  map = Map.LoadOrGet(warp.DestMapId);
            int  x   = warp.DestX;
            int  y   = warp.DestY;
            byte e   = warp.DestElevation;

            Map.Layout.Block block = map.GetBlock_CrossMap(x, y, out map); // GetBlock_CrossMap in case our warp is actually in a connection for some reason
            // Facing is of the original direction unless the block behavior says otherwise
            // All QueuedScriptMovements will be run after the warp is complete
            switch (block.BlocksetBlock.Behavior)
            {
            case BlocksetBlockBehavior.Warp_WalkSouthOnExit:
            {
                Facing = FacingDirection.South;
                QueuedScriptMovements.Enqueue(ScriptMovement.Walk_S);
                break;
            }

            case BlocksetBlockBehavior.Warp_NoOccupancy_S:
            {
                Facing = FacingDirection.North;
                y--;
                break;
            }
            }
            UpdateMap(map);
            Pos.X         = x;
            Pos.Y         = y;
            Pos.Elevation = e;
            PrevPos       = Pos;
            if (CameraObj.CameraAttachedTo == this)
            {
                CameraObj.CameraCopyMovement();
            }
        }
Beispiel #12
0
 public ProgressiveWarpFractal(IWarp warp) : base(warp)
 {
 }
 public NoneWarpFractal(IWarp warp) : base(warp)
 {
 }
Beispiel #14
0
 public AbstractWarpFractal(IWarp warp)
 {
     Warp = warp ?? throw new ArgumentNullException(nameof(warp));
 }
Beispiel #15
0
 /// <inheritdoc/>
 public void CreateWarp(IWarp warp)
 {
     _warpRepository.Create(warp);
 }
Beispiel #16
0
 /// <inheritdoc/>
 public void RemoveWarp(IWarp warp)
 {
     _warpRepository.Delete(warp);
 }
 public IndependentWarpFractal(IWarp warp) : base(warp)
 {
 }
 public BasicWarpFractal(IWarp warp) : base(warp)
 {
 }