Example #1
0
    public GameObject Instantiate(BattleMapMonsterType monsterType, int sortingOrder)
    {
        string str = monsterType.ToString().ToLower().Replace("_", "");

        GameObject prefab = PrefabUtils.GetPrefab(this, str);

        GameObject go = Instantiate(prefab) as GameObject;

        go.GetComponent <SpriteRenderer>().sortingOrder = sortingOrder;

        return(go);
    }
Example #2
0
    // TODO: クラス取得仮
    private string GetMonsterClassName(BattleMapMonsterType monsterType)
    {
        switch (monsterType)
        {
        case BattleMapMonsterType.MONSTER_184:
            return("ネオコマンドウルフ");

        case BattleMapMonsterType.MONSTER_189:
            return("トナカイ戦士");

        default:
            return("no name");
        }
    }
Example #3
0
    // TODO: 名前取得仮
    private string GetMonsterName(BattleMapMonsterType monsterType)
    {
        switch (monsterType)
        {
        case BattleMapMonsterType.MONSTER_184:
            return("ウルフ太郎ウルスケ");

        case BattleMapMonsterType.MONSTER_189:
            return("トナトナ");

        default:
            return("no name");
        }
    }
    /// <summary>
    /// 顔のスプライトを取得
    /// </summary>
    /// <param name="monsterType"></param>
    /// <returns></returns>
    private Sprite GetFaceImageSprite(BattleMapMonsterType monsterType)
    {
        // キャッシュから取得
        bool exists = monsterFaceSpriteDic.ContainsKey(monsterType);

        if (exists)
        {
            return(monsterFaceSpriteDic[monsterType]);
        }

        // パスを作成
        string typeStr   = monsterType.ToString().ToLower();
        string imagePath = IMAGE_FACE_RESOURCE_PREFIX + typeStr;

        // スプライトを取得
        return(Resources.Load <Sprite>(imagePath));
    }
Example #5
0
    /// <summary>
    /// モンスターの設置
    /// </summary>
    /// <param name="bmt"></param>
    public void InstallMonster(BattleMapTile bmt)
    {
        List <BattleMapMonster> monsterList = holder.BattleMapMonsters.MonsterList;

        // 既にいたら除去
        int existIndex = -1;

        for (int i = 0; i < monsterList.Count; i++)
        {
            BattleMapMonster bmm = monsterList[i];
            if (bmt.X == bmm.X && bmt.Y == bmm.Y)
            {
                existIndex = i;
            }
        }

        // いる場合は除去して終了
        if (0 <= existIndex)
        {
            BattleMapMonster bmm = monsterList[existIndex];
            Destroy(bmm.GameObject);
            monsterList.Remove(bmm);

            // マーカーを除去
            mapIconGenerator.UninstallMonsterMarker(bmm);

            return;
        }

        // モンスターのタイプ
        BattleMapMonsterType monsterType = GetMonsterTypeByDropdown();

        // 作成
        BattleMapMonster monster = new BattleMapMonster();

        monster.Id = "" + index;
        index++;
        monster.X         = bmt.X;
        monster.Y         = bmt.Y;
        monster.Name      = GetMonsterName(monsterType);
        monster.ClassName = GetMonsterClassName(monsterType);
        GameObject go = GetMonsterGameObject(bmt, monsterType);

        monster.GameObject = go;

        // スキル
        monster.SkillList        = CreateMonsterSkillList();
        monster.CounterSkillList = CreateMonsterCounterSkillList();

        // チーム
        BattleMapTeam team = GetTeamByDropdown();

        monster.Team = team;

        // ステータスの作成
        BattleMapMonsterStatus monsterStatus = new BattleMapMonsterStatus();

        monsterStatus.MoveCount   = 3;
        monsterStatus.MonsterType = monsterType;

        monster.BattleStatus = monsterStatus;

        // 位置の調整
        ConditionMonsterPosition(bmt, monster);

        // ホルダーに追加
        monsterList.Add(monster);

        // サークルの設定
        mapIconGenerator.InstallMonsterMarker(monster);

        // 視界の設定
        BattleMapUnmasker unmasker = new BattleMapUnmasker(holder, mapObjectGenerator);

        unmasker.Unmask(monster);
    }
Example #6
0
    /// <summary>
    /// モンスターのゲームオブジェクトを取得
    /// </summary>
    /// <returns></returns>
    private GameObject GetMonsterGameObject(BattleMapTile bmt, BattleMapMonsterType monsterType)
    {
        int sortingOrder = GetMonsterSortingOrder(bmt.Y);

        return(monsterPrefabHolder.Instantiate(monsterType, sortingOrder));
    }