Beispiel #1
0
        private bool CanPlaceFigureOnRoad(ITile currentTile, CardinalDirection whereToGo, bool firstCall)
        {
            ITile neighborTile = TileUtils.GetNeighborTile(TileUtils.GetSurroundingTiles(currentTile), whereToGo);

            if (firstCall)
            {
                _firstTile = currentTile;
                if (IsEndOfRoad(currentTile))
                {
                    return(CanPlaceFigureOnRoad(currentTile, whereToGo, false));
                }
                else
                {
                    CardinalDirection otherSide = CardinalDirection.North;
                    for (int i = 0; i < 4; i++)
                    {
                        if (currentTile.Directions[i].Landscape == Landscape.Road && i != (int)whereToGo)
                        {
                            otherSide = (CardinalDirection)i;
                        }
                    }

                    return(CanPlaceFigureOnRoad(currentTile, whereToGo, false) &&
                           CanPlaceFigureOnRoad(currentTile, otherSide, false));
                }
            }

            this.CheckFigureOnTile(currentTile, (int)whereToGo);

            if (neighborTile == null || neighborTile.Position.Equals(_firstTile.Position))
            {
                return(_canPlaceFigure);
            }

            if (IsEndOfRoad(neighborTile))
            {
                CheckFigureOnTile(neighborTile, (int)TileUtils.GetOppositeDirection(whereToGo));
                return(neighborTile.Directions[(int)TileUtils.GetOppositeDirection(whereToGo)].Figure == null && _canPlaceFigure);
            }

            for (int i = 0; i < 4; i++)
            {
                if (neighborTile.Directions[i].Figure != null &&
                    neighborTile.Directions[i].Landscape == Landscape.Road)
                {
                    this.CheckFigureOnTile(currentTile, i);
                    _canPlaceFigure = false;
                }
            }

            for (var i = 0; i < 4; i++)
            {
                if (neighborTile.Directions[i].Landscape == Landscape.Road && i != (int)TileUtils.GetOppositeDirection(whereToGo))
                {
                    return(CanPlaceFigureOnRoad(neighborTile, neighborTile.GetCardinalDirectionByIndex(i), false));
                }
            }

            return(_canPlaceFigure);
        }
Beispiel #2
0
        public override void ReactionComplete()
        {
            //If the parent isn't loaded, save the changes in our own slots
            //Otherwise, modify the parent MachineUI directly
            ReinforcedFurnaceUI ui = ParentState as ReinforcedFurnaceUI;

            if (!(ui?.Active ?? false))
            {
                Item input  = GetItem(0);
                Item result = GetItem(1);
                Do_Reaction(input, result);

                //	Main.NewText($"Edited entity slots: \"{Lang.GetItemNameValue(fuel.type)}\" ({fuel.stack}), \"{Lang.GetItemNameValue(result.type)}\" ({result.stack})");
            }
            else
            {
                UIItemSlot input      = ui.GetSlot(0);
                UIItemSlot resultSlot = ui.GetSlot(1);

                Do_Reaction(input.StoredItem, resultSlot.StoredItem);

                //	Main.NewText($"Edited UI slots: \"{Lang.GetItemNameValue(fuel.StoredItem.type)}\" ({fuel.StoredItem.stack}), \"{Lang.GetItemNameValue(resultSlot.StoredItem.type)}\" ({resultSlot.StoredItem.stack})");
            }

            Vector2 center = TileUtils.TileEntityCenter(this, MachineTile);

            this.PlayCustomSound(center, "Flame Arrow");
        }
Beispiel #3
0
        public override void PreUpdateReaction()
        {
            if (Heating)
            {
                targetHeat = HeatMax;

                Vector2 center = TileUtils.TileEntityCenter(this, MachineTile);

                burning = this.PlayCustomSound(center, "CampfireBurning");
            }
            else
            {
                targetHeat = HeatMin;
                burning?.Stop();
            }

            //Stop the sound if the game isn't in focus
            // TODO: this doesn't work; the sound keeps playing while the game isn't in focus...
            if (!Main.hasFocus)
            {
                burning?.Stop();
            }

            ReactionInProgress = true;
        }
        private async void channelDetailFactory_Successed(object sender, HttpFactoryArgs <ChannelDetailInfo> e)
        {
            _dataSource = e.Result;

            if (_dataSource.IsNumber)
            {
                channelList.GridCellSize = new Size(154, 147);
            }
            else
            {
                channelList.GridCellSize = new Size(154, 195);
            }

            if (_dataSource.ProgramInfos == null)
            {
                TileUtils.CreateBasicToast("该节目信息不存在!");
                NavigationService.GoBack();
                return;
            }

            if (!_dataSource.IsNumber && _dataSource.ProgramInfos.Count == 1)
            {
                _dataSource.ProgramInfos[0].Title = string.Format("{0} 全一集", _dataSource.ProgramInfos[0].Title);
            }
            DataContext = _dataSource;

            channelList.ItemsSource  = _dataSource.ProgramInfos;
            downloadList.ItemsSource = _dataSource.ProgramInfos;

            await UpdateDownloadState();

            loadingTip.Visibility = Visibility.Collapsed;
            //ShareUtils.ShareInfo = new PlayShareInfo(_dataSource.Id, _dataSource.Title, _dataSource.ImageUri);
        }
 private void ApplicationBarFav_Click(object sender, EventArgs e)
 {
     try
     {
         if (_dataSource != null && _favBar.Text == "收藏")
         {
             var v = new CloudDataInfo()
             {
                 Id       = _dataSource.Id,
                 Name     = _dataSource.Title,
                 SubId    = _dataSource.Id,
                 SubName  = _dataSource.Title,
                 Mark     = _dataSource.Mark,
                 Duration = (int)(_dataSource.Duration * 60),
                 ImageUri = _dataSource.ImageUri
             };
             LocalFavoritesFactory.Instance.InsertLocalRecord(v);
             _favBar.IsEnabled = false;
             _favBar.Text      = "已收藏";
             TileUtils.CreateBasicToast("收藏成功!");
         }
     }
     catch
     {
         TileUtils.CreateBasicToast("收藏失败!");
     }
 }
Beispiel #6
0
 public void RespawnPlayer()
 {//Changer mettre ca sur l'eau en collider
     transform.position = GetClosestTile(TileUtils.GetTilesForPlayer(GetComponent <Player>())).position + new Vector3(0, RESPAWN_HEIGHT, 0);
     GetComponent <Rigidbody>().velocity        = Vector3.zero;
     GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
     transform.rotation = Quaternion.identity;
 }
Beispiel #7
0
        private async void Navigate(object parameter)
        {
            await Init();

            TileUtils.CreateLogoNotifications();
            loadingGrid.Visibility = Visibility.Collapsed;

            var profile = NetworkInformation.GetInternetConnectionProfile();

            if (profile != null)
            {
                var netWork = profile.GetNetworkConnectivityLevel();
                if (netWork == NetworkConnectivityLevel.InternetAccess)
                {
                    this.MainFrame.Navigate(typeof(FirstPage));

                    if (parameter is LaunchActivatedEventArgs)
                    {
                        var paras = (parameter as LaunchActivatedEventArgs).Arguments;
                        ((App.Current) as App).SecondaryTileNavgate(paras);
                    }
                    else if (parameter is string)
                    {
                        this.MainFrame.Navigate(typeof(Pages.SearchPage), parameter);
                    }
                    else if (parameter is Windows.Storage.StorageFile)
                    {
                        this.MainFrame.Navigate(typeof(Pages.PlayPage), parameter);
                    }
                    return;
                }
            }
            CommonUtils.ShowMessageConfirm(Constants.NotNetworkTip, navigate_Determimine, navigate_Refresh, "确定", "刷新");
        }
Beispiel #8
0
        private IEnumerable <IFeature> EnumerateOsmDataAsGeoJson(BoundingBox bbox, IOsmDataSettings filter)
        {
            string directoryName = Path.Combine(filter.FlatGeobufTilesDirectory, filter.FilterIdentifier);

            var tiles = TileUtils.GetTilesInBoundingBox(bbox, TILE_ZOOM_LEVEL, TILE_SIZE)
                        .Select(tile => new OpenStreetMapDotNet.MapTileInfo(tile.X, tile.Y, tile.Zoom, tile.TileSize))
                        .Where(tile => FlatGeoBufFileSystem.FileExists(tile, directoryName))
                        .ToList();

            if (tiles.Count == 0)
            {
                throw new Exception($"All required tiles are missing");
            }

            int i = 0;

            foreach (var tile in tiles)
            {
                _logger.LogInformation($"Reading tiles from {directoryName}... {(i / (float)tiles.Count):P1}");

                var osmTileInfo             = new OpenStreetMapDotNet.MapTileInfo(tile.X, tile.Y, tile.Zoom, tile.TileSize);
                FlatGeobufTileReader reader = new FlatGeobufTileReader(osmTileInfo, directoryName);

                foreach (IFeature way in reader.GetEnumerator())
                {
                    yield return(way);
                }
                i++;
            }
        }
Beispiel #9
0
    IEnumerator SpawnOrDelay()
    {
        enemyUI.ActionImageOn();

        if (currentRoom.enemyList.Count <= 3) //소환
        {
            List <Arch.Tile> targets = TileUtils.DiagonalRange(currentTile, 1);

            for (int i = 0; i < targets.Count; i++)
            {
                if (targets[i].IsStandAble(this))
                {
                    Entity e = ArchLoader.instance.GetEntity(4007);
                    e.Init(4007);
                    e.SetRoom(currentRoom, targets[i]);
                }
            }

            //yield return StartCoroutine(AnimationRoutine(0));
            yield return(null);
        }
        else
        {
            yield return(null);
        }
    }
Beispiel #10
0
    private void Update()
    {
        if (IsActive && m_mouseEventReady)
        {
            Vector2       mousePos  = TileUtils.NormalizedMousePosition();
            GameObject    obj       = TileManagerScript.TileManager.GetGameObject(mousePos);
            DataPublisher publisher = obj?.GetComponent <DataPublisher>();

            if (m_state == State.WirePlacing)
            {
                DrawLine(mousePos);

                if (m_mouseEventReady && Input.GetMouseButtonUp(MouseUtils.PRIMARY_MOUSE_BUTTON) && publisher != null && m_publisherFrom != publisher)
                {
                    m_state             = State.SelectPortTo;
                    m_selectedPortIndex = -1;
                    ShowPortList(mousePos, publisher.PortList);
                }
            }
            else if (m_state == State.Idle)
            {
                if (Input.GetMouseButtonUp(MouseUtils.PRIMARY_MOUSE_BUTTON) && publisher != null)
                {
                    m_fromPosition  = mousePos;
                    m_state         = State.SelectPortFrom;
                    m_publisherFrom = publisher;
                    ShowPortList(mousePos, publisher.PortList);
                }
            }
        }

        m_mouseEventReady = true;
    }
Beispiel #11
0
 public override void PreUpdateReaction()
 {
     if ((float)StoredFlux > 0)
     {
         Lighting.AddLight(TileUtils.TileEntityCenter(this, MachineTile), Color.Green.ToVector3() * 0.3f);
     }
 }
Beispiel #12
0
 private async void PineToStart_Click(object sender, RoutedEventArgs e)
 {
     foreach (var dataItem in historyListView.SelectedItems)
     {
         await TileUtils.Pin_Start(dataItem, true, Utils.Constants.LogoUri);
     }
     historyListView.SelectedIndex = -1;
 }
 private void UpdateTiles(ITile justPlacedTile, GamePlay gamePlay)
 {
     foreach (var placedTile in SurroundingTilesByCoordinates(justPlacedTile, gamePlay))
     {
         placedTile.Value.Directions[(int)TileUtils.GetOppositeDirection(placedTile.Key)].Neighbor = justPlacedTile;
         justPlacedTile.Directions[(int)placedTile.Key].Neighbor = placedTile.Value;
     }
 }
Beispiel #14
0
        internal void UpdateGrid()
        {
            if (!updateNeeded)
            {
                return;
            }
            updateNeeded = false;

            Clear();

            List <int> tiles;
            List <int> walls;

            if (btnFilterNear.GetValue <bool>())
            {
                List <int>[] lists = ProtectToolsUtils.GetScreenContainTilesAndWalls();
                tiles = lists[0];
                walls = lists[1];
            }
            else
            {
                tiles = TileUtils.GetAllTiles();
                walls = WallUtils.GetAllWalls();
            }

            if (showTiles)
            {
                foreach (var itemType in tiles)
                {
                    Item item = new Item();
                    item.SetDefaults(itemType);

                    var box = new UITileWallSlot(item);
                    gridRight._items.Add(box);
                    gridRight._innerList.Append(box);
                    panelMain.AddDragTarget(box);
                }
            }
            if (showWalls)
            {
                foreach (var itemType in walls)
                {
                    Item item = new Item();
                    item.SetDefaults(itemType);

                    var box = new UITileWallSlot(item);
                    gridRight._items.Add(box);
                    gridRight._innerList.Append(box);
                    panelMain.AddDragTarget(box);
                }
            }

            gridRight.UpdateOrder();
            gridRight._innerList.Recalculate();

            panelMain.caption = caption.Replace("??", $"{gridRight.Count}");
        }
Beispiel #15
0
        public static IEnumerable <GeoPoint> ReprojectGeodeticToTileSystem(this IEnumerable <GeoPoint> points, int zoomLevel, int tileSize)
        {
            foreach (var p in points)
            {
                var newPt = TileUtils.PositionToGlobalPixel(new LatLong(p.Latitude, p.Longitude), zoomLevel, tileSize);

                yield return(new GeoPoint(newPt.Y, newPt.X, p.Elevation));
            }
        }
Beispiel #16
0
 IEnumerator WideAttackReady()
 {
     targetList = TileUtils.CircleRange(currentTile, 2);
     for (int i = 0; i < targetList.Count; i++)
     {
         rangeList.Add(ObjectPoolManager.instance.PoolRangeEffect(RangeEffectType.ENEMY, targetList[i]));
     }
     yield return(null);
 }
Beispiel #17
0
    private void CreateRemoverShadow()
    {
        if (m_shadow != null)
        {
            Destroy(m_shadow);
        }

        m_shadow = Instantiate(RemoverPrefab, TileUtils.NormalizedMousePosition(), TileUtils.InitRotation);
    }
Beispiel #18
0
 public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)
 {
     if (TileUtils.isProtected(i, j))
     {
         fail       = true;
         effectOnly = true;
         noItem     = true;
     }
 }
Beispiel #19
0
 public void GotoMainMenu()
 {
     Time.timeScale = 1;
     bucketSpawn    = false;
     SceneManager.LoadScene("MainMenu");
     VariablesGlobales.Reset();
     TileUtils.Reset();
     //GameTime.instance = null;
 }
Beispiel #20
0
    public override void CardEffectPreview()
    {
        List <Tile> targetTiles = TileUtils.Range(player.currentTile, 2, Figure.CIRCLE);

        for (int i = 0; i < targetTiles.Count; i++)
        {
            ranges.Add(ObjectPoolManager.instance.PoolRangeEffect(RangeEffectType.CARD, player, targetTiles[i]));
        }
    }
Beispiel #21
0
 private void SetPlayError(string errorMessage)
 {
     Debug.WriteLine(errorMessage);
     _playFactory.DacPlayInfo.isPlaySucceeded = 0;
     _playFactory.DacPlayInfo.stopReason      = 2;
     ClearTipInfo();
     TileUtils.CreateToastNotificationsText02("播放失败", errorMessage);
     GoBack(this, new RoutedEventArgs());
 }
Beispiel #22
0
        private void DoAutotool()
        {
            var player = Game1.player;
            var loc    = player.currentLocation;

            if (loc == null)
            {
                return;
            }

            if (player.IsMonsterInProximity(2.5f, out _))
            {
                player.EquipTool(ToolType.MeleeWeapon);
                return;
            }

            var target             = player.GetToolLocation();
            var toolLocationVector = new Vector2((int)target.X / Game1.tileSize, (int)target.Y / Game1.tileSize);

            var props = TileUtils.GetTileProperties(toolLocationVector);

            var str = string.Join(", ", props.GetIndividualFlags());

            Monitor.Log(target.ToString() + " => " + str);


            if (props.HasFlag(TileProperties.Cuttable))
            {
                player.EquipTool(ToolType.Scythe);
                return;
            }

            if (props.HasFlag(TileProperties.Mineable))
            {
                player.EquipTool(ToolType.Pickaxe);
                return;
            }

            if (props.HasFlag(TileProperties.Choppable))
            {
                player.EquipTool(ToolType.Axe);
                return;
            }

            if (props.HasFlag(TileProperties.Waterable))
            {
                player.EquipTool(ToolType.WateringCan);
                return;
            }

            if (props.HasFlag(TileProperties.Diggable))
            {
                player.EquipTool(ToolType.Hoe);
                return;
            }
        }
Beispiel #23
0
    IEnumerator AtkReady()
    {
        List <Arch.Tile> tiles = TileUtils.CrossRange(currentTile, 2);

        for (int i = 0; i < tiles.Count; i++)
        {
            rangeList.Add(ObjectPoolManager.instance.PoolRangeEffect(RangeEffectType.ENEMY, tiles[i]));
        }
        yield return(null);
    }
Beispiel #24
0
        /// <summary>
        /// 登录成功回调
        /// </summary>
        public static void LoginSucess_Handler()
        {
            TileUtils.CreateToastNotifications("登录成功");
            PersonalFactory.Instance.DataInfos[0].IsCurrentLogin = true;
            PersonalInfo personalInfo = PersonalFactory.Instance.DataInfos[0];

            MainPage.InitWAY();
            _cloudRecentGetFactory.DownLoadDatas(personalInfo.UserStateInfo.UserName, CloudType.Recent);
            _cloudFavolitenGetFactory.DownLoadDatas(personalInfo.UserStateInfo.UserName, CloudType.Favorites);
        }
Beispiel #25
0
        public override void RightClick(Player player)
        {
            Point16     tilePos = Main.MouseWorld.ToPoint16();
            PlantEntity entity  = TileUtils.GetTileEntity <PlantEntity>(tilePos);

            if (entity != null)
            {
                entity.hasBeenWatered = true;
            }
        }
Beispiel #26
0
        private void ArenaTiles_MouseMove(object sender, MouseEventArgs e)
        {
            Point mousePosition = Mouse.GetPosition((IInputElement)sender);

            SelectionEffect.MousePosition  = new Point(mousePosition.X / arenaCanvasSize, mousePosition.Y / arenaCanvasSize);
            SelectionEffect.HighlightColor = TileUtils.GetColorFromHeight(heightSelectorValue).ToPoint4D(0.5f);
            UpdateSelectionEffectContinuousValues();

            focusedTile = new ArenaCoord(MathUtils.Clamp((int)mousePosition.X / TileUtils.TileSize, 0, Spawnset.ArenaWidth - 1), MathUtils.Clamp((int)mousePosition.Y / TileUtils.TileSize, 0, Spawnset.ArenaHeight - 1));
            if (focusedTile == focusedTilePrevious)
            {
                return;
            }

            Canvas.SetLeft(CursorRectangle, focusedTile.X * TileUtils.TileSize);
            Canvas.SetTop(CursorRectangle, focusedTile.Y * TileUtils.TileSize);

            TileCoordLabel.Content = focusedTile.ToString();
            SetHeightText(SpawnsetHandler.Instance.spawnset.ArenaTiles[focusedTile.X, focusedTile.Y]);

            if (continuous)
            {
                ExecuteTileAction(focusedTile);
            }

            if (rectangleStart.HasValue)
            {
                MultiSelectRectLeft.Visibility   = Visibility.Visible;
                MultiSelectRectRight.Visibility  = Visibility.Visible;
                MultiSelectRectTop.Visibility    = Visibility.Visible;
                MultiSelectRectBottom.Visibility = Visibility.Visible;

                MultiSelectRectLeft.X1 = Math.Min(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectLeft.X2 = Math.Min(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectLeft.Y1 = Math.Min(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectLeft.Y2 = Math.Max(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;

                MultiSelectRectRight.X1 = Math.Max(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectRight.X2 = Math.Max(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectRight.Y1 = Math.Min(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectRight.Y2 = Math.Max(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;

                MultiSelectRectTop.X1 = Math.Min(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectTop.X2 = Math.Max(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectTop.Y1 = Math.Min(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectTop.Y2 = Math.Min(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;

                MultiSelectRectBottom.X1 = Math.Min(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectBottom.X2 = Math.Max(rectangleStart.Value.X, focusedTile.X) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectBottom.Y1 = Math.Max(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;
                MultiSelectRectBottom.Y2 = Math.Max(rectangleStart.Value.Y, focusedTile.Y) * TileUtils.TileSize + TileUtils.TileSize / 2;
            }

            focusedTilePrevious = focusedTile;
        }
Beispiel #27
0
        private void SearchFiguresOnRoad(ITile currentTile, CardinalDirection whereToGo, bool firstCall)
        {
            if (firstCall)
            {
                _firstTile = currentTile;
                if (IsEndOfRoad(currentTile) && currentTile.GetTileSideByCardinalDirection(whereToGo).Landscape == Landscape.Road)
                {
                    CheckFigureOnTile(currentTile, (int)whereToGo);
                    SearchFiguresOnRoad(currentTile, whereToGo, false);
                }
                else if (!IsEndOfRoad(currentTile) && currentTile.GetTileSideByCardinalDirection(whereToGo).Landscape == Landscape.Road &&
                         SearchEndOfRoadTileInGivenDirection(currentTile, whereToGo) != null)
                {
                    var firstTile = SearchEndOfRoadTileInGivenDirection(currentTile, whereToGo);
                    _firstTile = firstTile;
                    CheckFigureOnTile(_firstTile, (int)_whereToGoAfterEndFound);
                    SearchFiguresOnRoad(firstTile, _whereToGoAfterEndFound, false);
                }
            }
            else
            {
                var neighborTile = TileUtils.GetNeighborTile(TileUtils.GetSurroundingTiles(currentTile), whereToGo);

                if (neighborTile == null)
                {
                    _figuresOnTiles.Clear();
                    return;
                }

                if (IsEndOfRoad(neighborTile) || neighborTile.Position.Equals(_firstTile.Position))
                {
                    CheckFigureOnTile(neighborTile, (int)TileUtils.GetOppositeDirection(whereToGo));
                    return;
                }

                int sideNumber = (int)TileUtils.GetOppositeDirection(whereToGo);

                for (int i = 0; i < 4; i++)
                {
                    if (neighborTile.Directions[i].Landscape == Landscape.Road)
                    {
                        CheckFigureOnTile(neighborTile, i);
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    if (neighborTile.Directions[i].Landscape == Landscape.Road && i != sideNumber)
                    {
                        SearchFiguresOnRoad(neighborTile, neighborTile.GetCardinalDirectionByIndex(i), false);
                        break;
                    }
                }
            }
        }
Beispiel #28
0
    /// <summary>
    /// Init all button with assetbundle tile
    /// /// </summary>
    void InitScrollViewButton(LayerDepth _layerDepth)
    {
        TileBase[] tilesBase = null;
        bool       isFirst   = true;

        switch (_layerDepth)
        {
        case LayerDepth.Tile:
            tilesBase = AssetManager.Instance.GetAllTile();
            break;

        case LayerDepth.Object:
            tilesBase = AssetManager.Instance.GetAllObject();
            break;
        }

        if (tilesBase == null)
        {
            Debug.LogAssertion("InitScrollViewButton :: tilesBase == null");
            return;
        }

        foreach (TileBase tilebase in tilesBase)
        {
            // Set GameObject
            GameObject gButton  = GameObject.Instantiate(footerButtonPrefabs, SelectTileViewParent(_layerDepth));
            Button     uiButton = gButton.GetComponent <Button>();
            gButton.transform.name = SelectTileViewName(_layerDepth) + tilebase.name;
            gButton.GetComponentInChildren <Text>().text = tilebase.name;

            // Get TileType
            TileUtils.TileType tileType = TileUtils.ParseTileTypeName(tilebase.GetType().ToString());

            // Set button callback :: warning layerdepth define by tiletype it can be source of bug in the future if more tiletype will add
            uiButton.onClick.AddListener(delegate { SetSelectTileName(tilebase.name, _layerDepth); });

            Sprite sprite = null;
            AssetManager.SetSpriteByType(tilebase, out sprite);

            if (sprite)
            {
                gButton.GetComponentInChildren <Image>().sprite = sprite;

                if (isFirst)
                {
                    selectedTileViewer.sprite = sprite;
                    isFirst = false;
                }
            }
            else
            {
                Debug.LogError(tilebase.name + " sprite is null");
            }
        }
    }
Beispiel #29
0
 protected override void Think()
 {
     if (TileUtils.AI_CircleFind(currentTile, 1))
     {
         currentActionList = attackList;
     }
     else
     {
         currentActionList = moveList;
     }
 }
Beispiel #30
0
        public virtual bool IsPassableAt(Vector3Int from, Vector3Int to)
        {
            if (from == to)
            {
                return(true);
            }

            BasicTile tileTo = tilemap.GetTile <BasicTile>(to);

            return(TileUtils.IsPassable(tileTo));
        }