Exemple #1
0
 //油田探索
 void srcOil(cpuUnit cUnit)
 {
     cUnit.cWorkType = CpuWorkType.SrcMove;
     map.getRoute(cUnit.tgtUnit.pos, cUnit.cpuTgtPos, 1, (mvList, dist) => {
         Debug.Log(" getRoute ret[" + dist + "] ");
         moveChkCb(cUnit, mvList, dist);
     });
 }
Exemple #2
0
    //A-Starでの移動(OList = 移動不可の位置)
    public void doMove(Vector2Int epos, Vector2Int?_spos = null, List <Vector2Int> Olist = null)
    {
        if (works != WorkType.Moving)
        {
            chgWorkType(WorkType.PreMove);
        }
        var spos = _spos ?? pos;

        LastDest = map.GetComponent <Grid>().CellToLocal(new Vector3Int(MapCtl.offset_stg2tile_x(epos.x), MapCtl.offset_stg2tile_y(epos.y), 0));
        //Debug.Log (string.Format ("doMove: ({0},{1})", spos, epos));

        switch (type)
        {
        case uType.Infantry:                                 /* 歩兵   */
            map.getRoute(spos, epos, 2, doAstMoveCb, Olist); //A-Sterによる経路取得
            break;

        case uType.Vehicle:                                  /* 車両   */
            map.getRoute(spos, epos, 1, doAstMoveCb, Olist); //A-Sterによる経路取得
            break;

        case uType.Aircraft:          /* 航空機 */
            destList.Clear();
            chgWorkType(WorkType.Moving);
            destList.Add(epos);
            break;

        case uType.Warship:                                  /* 戦艦   */
        case uType.Submarine:                                /* 潜水艦 */
            map.getRoute(spos, epos, 0, doAstMoveCb, Olist); //A-Sterによる経路取得
            break;

        default:                              /* その他 */
            break;
        }
    }