예제 #1
0
    public void Unmask(BattleMapMonster monster)
    {
        BattleMapTile centerTile = holder.BattleMap.BattleMapTiles[monster.X, monster.Y];

        // 視界のタイルセットを取得
        List <BattleMapTile> set = MapUtils.GetRangeTileList(centerTile, monster.BattleStatus.View);

        BattleMapTileMaskGroup maskGroup = holder.BattleMap.BattleMapTileMaskGroup[monster.GetTeamIndex()];

        foreach (BattleMapTile bmt in set)
        {
            // マスクを取得
            BattleMapTileMask mask = maskGroup.BattleMapTileMask[bmt.X, bmt.Y];

            // すでにマスク解除されているならなにもしない
            if (mask.Mask == false)
            {
                continue;
            }

            mask.Mask = false;
            mask.GameObject.SetActive(false);
            mask.GameObjectShadow.SetActive(false);

            // オブジェクトが存在しない場合
            // オブジェクトを描画
            BattleMapObjectSet bmoSet = holder.BattleMap.BattleMapObjectSets[bmt.X, bmt.Y];
            if (bmoSet == null)
            {
                mapObjectGenerator.DecoreteMapTile(bmt);
            }
        }
    }
예제 #2
0
    /// <summary>
    /// マスクを作成
    /// </summary>
    /// <param name="battleMap"></param>
    private void CreateMask(BattleMap battleMap)
    {
        battleMap.BattleMapTileMaskGroup = new BattleMapTileMaskGroup[holder.BattleMapTeams.TeamList.Count];

        for (int i = 0; i < battleMap.BattleMapTileMaskGroup.Length; i++)
        {
            int sizeX = battleMap.BattleMapTiles.GetLength(0);
            int sizeY = battleMap.BattleMapTiles.GetLength(1);

            BattleMapTileMaskGroup maskGroup = new BattleMapTileMaskGroup(sizeX, sizeY);
            battleMap.BattleMapTileMaskGroup[i] = maskGroup;
        }
    }
    /// <summary>
    /// 移動チェック
    /// </summary>
    /// <param name="monster"></param>
    /// <param name="targetTile"></param>
    /// <param name="moveCount"></param>
    /// <param name="movableTileSet"></param>
    private void CheckMove(
        BattleMapMonster monster, BattleMapTile targetTile, int moveCount, HashSet <BattleMapTile> movableTileSet)
    {
        // 該当タイルに別モンスターがいたら侵入不可
        BattleMapMonster anotherMonster = holder.BattleMapMonsters.GetMonster(targetTile.X, targetTile.Y);

        if (anotherMonster != null && monster != anotherMonster)
        {
            return;
        }

        // マスクしてあったら侵入不可
        BattleMapTileMaskGroup group = holder.BattleMap.BattleMapTileMaskGroup[monster.GetTeamIndex()];
        BattleMapTileMask      mask  = group.BattleMapTileMask[targetTile.X, targetTile.Y];

        if (mask.Mask)
        {
            return;
        }

        // 移動コストを取得
        MapTileType tileType = targetTile.MapTileType;
        int         cost     = monster.BattleStatus.BattleMapMonsterMoveCost.GetMoveCost(tileType);

        // 侵入不可の場合
        if (cost < 0)
        {
            return;
        }

        // このタイルを移動可能に追加
        movableTileSet.Add(targetTile);

        // タイルのコストごとに移動力を減少
        moveCount = moveCount - cost;

        // 移動力がなくなったら終了
        if (moveCount <= 0)
        {
            return;
        }

        // タイルごとの処理
        foreach (BattleMapTile jointTile in targetTile.JointInfo.GetJointTileList())
        {
            CheckMove(monster, jointTile, moveCount, movableTileSet);
        }
    }
예제 #4
0
    /// <summary>
    /// マスクのコントロール
    /// </summary>
    public void ControllMask()
    {
        bool isNotMask = !toggleMaskOff.isOn;

        // マスクの設定
        BattleMapTileMaskGroup maskGroup = holder.BattleMap.BattleMapTileMaskGroup[0];

        foreach (BattleMapTileMask mask in maskGroup.BattleMapTileMask)
        {
            // 現時点のマスク対象のみ
            if (mask.Mask)
            {
                mask.GameObject.SetActive(isNotMask);
                mask.GameObjectShadow.SetActive(isNotMask);
            }
        }
    }
예제 #5
0
    /// <summary>
    /// マップタイルを作成
    /// </summary>
    /// <param name="map"></param>
    public void CreateMapTile(int[,] map)
    {
        BattleMapCreator creator   = new BattleMapCreator(holder);
        BattleMap        battleMap = creator.Create(map);

        holder.BattleMap = battleMap;

        // マップタイルを描画
        foreach (BattleMapTile bmt in battleMap.BattleMapTiles)
        {
            GameObject go = prefabHolder.Instantiate(bmt);
            bmt.GameObject = go;
        }

        // マスクを描画
        foreach (BattleMapTileMaskGroup maskGroup in battleMap.BattleMapTileMaskGroup)
        {
            foreach (BattleMapTileMask mask in maskGroup.BattleMapTileMask)
            {
                BattleMapTile tile = battleMap.BattleMapTiles[mask.X, mask.Y];
                GameObject    go   = prefabHolder.InstantiateMask(tile);
                mask.GameObject = go;
                GameObject goShadow = prefabHolder.InstantiateMaskShadow(tile);
                mask.GameObjectShadow = goShadow;
            }
        }

        // TODO: いったん自チーム以外は非アクティブ
        for (int i = 1; i < battleMap.BattleMapTileMaskGroup.Length; i++)
        {
            BattleMapTileMaskGroup maskGroup = battleMap.BattleMapTileMaskGroup[i];

            foreach (BattleMapTileMask mask in maskGroup.BattleMapTileMask)
            {
                mask.GameObject.SetActive(false);
                mask.GameObjectShadow.SetActive(false);
            }
        }
    }