private void MovingPlayer() { player.transform.position = Vector2.Lerp(choosenLevel.transform.position, moveTarget.position, moveTime * moveTimer); if (moveTimer * moveTime >= 1) { moving = false; choosenLevel = moveTarget.GetComponent <OverworldLevel>(); } moveTimer += Time.deltaTime; }
/// <summary> /// Description: Moves the main camera and level selection cursor to the selected level /// Rationale: Main camera and level selection cursor should move as the user selects a level to signify which level is selected /// </summary> /// <param name="overworldLevel">The selected level</param> private void Navigate(OverworldLevel overworldLevel) { if (CurrentState != LevelMenuState.Selecting || overworldLevel.chaosVoid.isLocked) { return; } currentlySelected = overworldLevel; SetTransitioningState(); Vector3 start = Camera.main.transform.position; Vector3 stop = new Vector3(cameraOffset.x + currentlySelected.transform.position.x, Camera.main.transform.position.y, cameraOffset.z + currentlySelected.transform.position.z); StartCoroutine(MoveCursor(navigationSpeed)); StartCoroutine(MoveCamera(navigationSpeed, start, stop)); StartCoroutine(SetCurrentState(LevelMenuState.Selecting, 1 - navigationSpeed)); StartCoroutine(LevelOverlayController.Instance.SetTitle(overworldLevel.chaosVoid.name, 1 - navigationSpeed)); }
private void Start() { levelPreviews = GetComponentsInChildren <OverworldLevel>(); // store initial position of camera cameraOffset = Camera.main.transform.position; if (levelPreviews.Length > 0) { // set camera + cursor position to the highest started level currentlySelected = levelPreviews.LastOrDefault(e => e.chaosVoid.started); if (!currentlySelected) { currentlySelected = levelPreviews[0]; } Vector3 start = Camera.main.transform.position; Vector3 stop = new Vector3(cameraOffset.x + currentlySelected.transform.position.x, Camera.main.transform.position.y, cameraOffset.z + currentlySelected.transform.position.z); StartCoroutine(MoveCamera(1, start, stop)); StartCoroutine(LevelOverlayController.Instance.SetTitle(currentlySelected.chaosVoid.name, 0)); } SetSelectingState(); }
/// <summary> /// Create a data adapter. /// </summary> public ZeldaCartridge(ISource source) { var conversionTable = new Lazy <ITextConversionTable>(() => new TextConversionTable()); var speechConverter = new Lazy <IStringConverter>(() => new SpeechStringConverter(conversionTable.Value)); var textConverter = new Lazy <IStringConverter>(() => new TextStringConverter(conversionTable.Value)); var fixedStringConverter = new Lazy <IFixedStringConverter>(() => new FixedStringConverter(conversionTable.Value)); var speechFormatter = new Lazy <IStringFormatter>(() => new StringFormatter()); // Character Text _characterText = new Lazy <IList <string> >(() => new CharacterText( new WordPointerTable(new SourceBlock(source, 0x4000), new SourceBlock(source, -0x4000), 0x26), speechFormatter.Value, speechConverter.Value, 0x556, 0x26)); // Ending Text _endingText = new Lazy <IEndingText>(() => new EndingText( new StringData(new SourceBlock(source, 0xA959), speechConverter.Value, 38), new FixedStringData(new SourceBlock(source, 0xAB07), fixedStringConverter.Value, 8), new FixedStringData(new SourceBlock(source, 0xAB0F), fixedStringConverter.Value, 24), new FixedStringData(new SourceBlock(source, 0xAB27), fixedStringConverter.Value, 20))); // Menu Text _menuText = new Lazy <IMenuText>(() => new MenuText( new FixedStringData(new SourceBlock(source, 0x09D48), fixedStringConverter.Value, 17), new FixedStringData(new SourceBlock(source, 0x09D5E), fixedStringConverter.Value, 18), new FixedStringData(new SourceBlock(source, 0x09D70), fixedStringConverter.Value, 8), new FixedStringData(new SourceBlock(source, 0x09EEB), fixedStringConverter.Value, 5))); // Underworld _underworld = new Lazy <IUnderworld>(() => { var underworldColumnPointers = new WordPointerTable( new SourceBlock(source, 0x16704), new SourceBlock(source, 0xC000), 10); var columnLibraries = new UnderworldColumnLibraryList( underworldColumnPointers); var grids = new UnderworldGridList( new SourceBlock(source, 0x18700), 4); var roomLayouts = new UnderworldRoomLayoutList( new SourceBlock(source, 0x160DE), 42); var levels = new UnderworldLevelList( new SourceBlock(source, 0x193FF), 9); return(new Underworld { ColumnLibraries = columnLibraries, Grids = grids, Levels = levels, RoomLayouts = roomLayouts }); }); // Overworld _overworld = new Lazy <IOverworld>(() => { var overworldColumnPointers = new WordPointerTable( new SourceBlock(source, 0x19D0F), new SourceBlock(source, 0x0C000), 16); var columnLibraries = new OverworldColumnLibraryList( overworldColumnPointers); var grid = new OverworldGrid( new SourceBlock(source, 0x18580)); var roomLayouts = new OverworldRoomLayoutList( new SourceBlock(source, 0x15418), 124); var tiles = new OverworldTileList( new SourceBlock(source, 0x1697C)); var detailTiles = new OverworldDetailTileList( new SourceBlock(source, 0x169B4)); var sprites = new OverworldSpriteList( new SourceBlock(source, 0x0C93B)); var level = new OverworldLevel( new SourceBlock(source, 0x19303)); var start = new OverworldStart( new SourceBlock(source, 0x19328)); return(new Overworld { ColumnLibraries = columnLibraries, Grid = grid, DetailTiles = detailTiles, RoomLayouts = roomLayouts, Tiles = tiles, Sprites = sprites, Level = level, Start = start }); }); // Shops _shops = new Lazy <IReadOnlyList <IShop> >(() => new ShopList( new SourceBlock(source, 0x18600), new SourceBlock(source, 0x045A2), new SourceBlock(source, 0x06E6F), 20)); // Intro scene _introScene = new Lazy <IScene>(() => new Scene( new SourceBlock(source, 0x1A3FE), conversionTable.Value)); // Title scene _titleScene = new Lazy <IScene>(() => new Scene( new SourceBlock(source, 0x1A869), conversionTable.Value)); // Hit points _hitPointTable = new Lazy <HitPointTable>(() => new HitPointTable( new SourceBlock(source, 0x1FB4E))); }
private void FindLevel(Vector2 posistion) { choosenLevel = Physics2D.OverlapCircle(posistion, 0.01f).GetComponent <OverworldLevel>(); }