Exemplo n.º 1
0
 public void Teleport(HexSprite m)
 {
     this.pos = m;
     this.rut = new List <Hex>()
     {
     };
     this.rut.Insert(0, HexGenerator.O);
 }
Exemplo n.º 2
0
 public static void Init(HexSprite p)
 {
     playable  = new Party(CharacterManager.FACTION.player, p);
     nonPlayer = new List <Party>()
     {
     };
     Hex2Char = new Dictionary <HexSprite, Character>()
     {
     };
 }
Exemplo n.º 3
0
 public Party(CharacterManager.FACTION f, HexSprite p, MODE m = MODE.physical)
 {
     this.faction = f;
     CharacterManager.GenParty(this);
     this.pos     = p;
     this.mode    = m;
     this.members = new List <Character>()
     {
     };
     this.rut = new List <Hex>()
     {
     };
 }
Exemplo n.º 4
0
        public void Move(Hex m)
        {
            this.pos += m;

            if (this.formUpTurn == 0)
            {
                this.rut.RemoveAt(this.rut.Count - 1);
            }
            for (int i = 0; i < this.rut.Count; i++)
            {
                this.rut[i] -= m;
            }
            this.rut.Insert(0, HexGenerator.O);
        }
Exemplo n.º 5
0
 private void HexGrid_HexEntered(HexSprite enteredSprite)
 {
     // if dragging a ship, see if we're entering a hex that ship can be put into or not
     if (_draggingAccordion != null)
     {
         if (!_draggingAccordion.Fleet.DeploymentHexes.Contains(_mapData.GetMapNode(enteredSprite.GridPosition.x, enteredSprite.GridPosition.y)))
         {
             //Cursor.SetCursor(_disabledCursorTexture, new Vector2(0.5f, 0.5f), CursorMode.Auto);
         }
         else
         {
             Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
         }
     }
 }
Exemplo n.º 6
0
        public Dictionary <HexSprite, (int, List <HexUnit>, HexSprite)> GetMinPaths(
            HexSprite s,
            int moveRange
            )
        {
            Dictionary <HexSprite, (int, List <HexUnit>, HexSprite)> minCostPath = new Dictionary <HexSprite, (int, List <HexUnit>, HexSprite)>()
            {
            };

            minCostPath[s] = (0, new List <HexUnit>()
            {
            }, null);
            FlatSightRecurcive(
                s, moveRange, minCostPath,
                FlatSight(s, s, moveRange, minCostPath)
                );
            return(minCostPath);
        }
Exemplo n.º 7
0
    public void RecurciveMove()
    {
        if (targetList.Count == 0)
        {
            StopWalk();
            Begin();
            this.p          = null;
            this.targetList = null;
            if (!(trapPrepared is null))
            {
                trapPrepared.SetActive(true);
                // TODO: trap process
                // ex. status.MOV.c -= 1;
                trapPrepared = null;
            }
            return;
        }
        ;

        pos   += targetList[0];
        startP = endP;
        if (valMax)
        {
            endP = startP - map.GetMoveCost(pos);
        }
        else
        {
            endP = startP - diffP;
        }

        Vector3 v = map.HexUnit2World(targetList[0]);

        target += v;
        if (v.x > 0)
        {
            turnRight();
        }
        if (v.x < 0)
        {
            turnLeft();
        }

        targetList.RemoveAt(0);
    }
Exemplo n.º 8
0
 public bool ModeS2P(int controllMemderId)
 {
     this.rut.RemoveRange(0, this.rut.Count);
     this.rut.Add(HexGenerator.O);
     foreach (Character m in this.members)
     {
         if (m.posParty == controllMemderId)
         {
             m.isPReader = true;
             this.pos   += m.posRel;
             m.posRel    = HexGenerator.O;
         }
         else
         {
             m.HideFromMap();
             m.isPReader = false;
         }
     }
     SetMode(MODE.physical);
     // BGM変更
     return(true);
 }
Exemplo n.º 9
0
 public bool hasWall(HexSprite h)
 {
     return(til.GetTileNameGroundWall() == GetTileName(layerGround, h));
 }
Exemplo n.º 10
0
 public bool hasGround(HexSprite h)
 {
     return(!isNull(layerGround, h));
 }
Exemplo n.º 11
0
 public static bool isNull(Tilemap tm, HexSprite h)
 {
     return(tm.GetTile((Vector3Int)h) is null);
 }
Exemplo n.º 12
0
 public static string GetTileName(Tilemap tm, HexSprite h)
 {
     return(GetTileName(tm.GetTile((Vector3Int)h)));
 }
Exemplo n.º 13
0
 public void FlatSightRecurcive(
     HexSprite s,
     int moveRange,
     Dictionary <HexSprite, (int, List <HexUnit>, HexSprite)> minCostPath,
Exemplo n.º 14
0
 public int GetMoveCost(HexSprite h)
 {
     return(Hex2MoveCost[h] + (CharacterManager.Hex2Char.ContainsKey(h) ? MOVECOST_EXIST_CHARACTER : 0));
 }
Exemplo n.º 15
0
 private void HexGrid_HexExited(HexSprite exitedSprite)
 {
     Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
 }
Exemplo n.º 16
0
 public bool hasOnGround(HexSprite h)
 {
     // trap, wall or something.
     return(!isNull(layerOnGround, h));
 }
Exemplo n.º 17
0
 public string GetGroundTileName(HexSprite h)
 {
     return(GetTileName(layerGround, h));
 }