Example #1
0
        public void Show(ClientParty party, ClientTile tile)
        {
            if (party.Tile == tile || tile == null)
            {
                Hide();
                return;
            }
            var pos = Camera.main.WorldToScreenPoint(tile.GetGameObject().transform.position);

            _gameObject.transform.position = pos;
            _gameObject.SetActive(true);
            var actions = new List <EntityAction>();

            if (tile.StaticEntity is ClientDungeon)
            {
                actions.Add(EntityAction.CHECK);
                actions.Add(EntityAction.ATTACK);
            }
            else
            {
                actions.Add(EntityAction.MOVE);
            }
            actions.Add(EntityAction.GUARD);
            BuildActions(actions.ToArray());
        }
Example #2
0
 internal void Add(ClientTile tile, params GameObject [] pathLines)
 {
     if (!_pathLines.ContainsKey(tile))
     {
         _pathLines[tile] = new List <GameObject>();
     }
     _pathLines[tile].AddRange(pathLines);
 }
Example #3
0
 private void CameraMove(Vector3 old, Vector3 newPos)
 {
     if (IsActive(_tileCursor))
     {
         Inactivate(_tileCursor);
     }
     _selectedTile = null;
 }
Example #4
0
 public void StartMoveReq(ClientParty party, List <ClientTile> path)
 {
     if (IsActive(_tileCursor))
     {
         Inactivate(_tileCursor);
     }
     _selectedTile = null;
 }
Example #5
0
 public void OnClickTile(ClientTile tile)
 {
     /*
      * var dungeon = tile.StaticEntity as ClientDungeon;
      * if (dungeon == null) return;
      * UIManager.DungeonsUI.Display(dungeon);
      */
 }
Example #6
0
 private void OnClickTile(ClientTile tile)
 {
     Log.Debug("Actions click tile");
     if (UIManager.PartyUI.HasSelectedParty)
     {
         Show(UIManager.PartyUI.SelectedParty, tile);
     }
 }
Example #7
0
    public static void FocusOnTile(ClientTile t)
    {
        Log.Debug($"Focusing on tile {t}");

        var camera    = Get();
        var coroutine = camera.LerpFromTo(camera.transform.position, new Vector3(t.X - 2, 5, t.Y - 2), 0.2f);

        camera.StartCoroutine(coroutine);
    }
Example #8
0
        private void MoveToSelectedTile(MovementIntent intent)
        {
            ClientParty party        = UIManager.PartyUI.SelectedParty;
            ClientTile  selectedTile = UIManager.TileUI.SelectedTile;

            Log.Debug($"Moving {party} to {selectedTile}");
            var map      = selectedTile.Chunk.Map;
            var path     = map.FindPath(party.Tile, selectedTile);
            var tilePath = path.Select(node => (ClientTile)map.GetTile(node.X, node.Y)).ToList();

            ClientEvents.StartMovementRequest(party, tilePath);
            MainBehaviour.Networking.Send(new MoveRequestEvent()
            {
                PartyIndex = party.PartyIndex,
                Path       = path.Select(p => new Game.World.Position(p.X, p.Y)).ToList(),
                Intent     = intent
            });
        }
Example #9
0
 public static void ActionSelected(ClientParty p, ClientTile tile, EntityAction action)
 {
     OnActionSelected?.Invoke(p, tile, action);
 }
Example #10
0
 public static void PartyFinishedMove(ClientParty p, ClientTile o, ClientTile n)
 {
     OnPartyFinishedMove?.Invoke(p, o, n);
 }
Example #11
0
 public static void ClickTile(ClientTile tile)
 {
     OnClickTile?.Invoke(tile);
 }