예제 #1
0
 /// <summary>
 /// 販売される商品をランダムで選択(とりあえず1種類1つずつ)
 /// </summary>
 private void ChooseSoldItems()
 {
     this.appearDungeonActiveItem  = this.mayAppearDungeonActiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonActiveItems.Count)];
     this.appearDungeonPassiveItem = this.mayAppearDungeonPassiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonPassiveItems.Count)];
     this.appearBattleActiveItem   = this.mayAppearBattleActiveItems[UnityEngine.Random.Range(0, this.mayAppearBattleActiveItems.Count)];
     this.appearBattlePassiveItem  = this.mayAppearBattlePassiveItems[UnityEngine.Random.Range(0, this.mayAppearBattlePassiveItems.Count)];
 }
예제 #2
0
    /// <summary>
    /// 宝箱を開ける処理。(全てのリストが1以上要素を持つ前提)
    /// </summary>
    private void OpenCursedTreasureChest(DungeonManager dm)
    {
        if (UnityEngine.Random.Range(0f, 1f) > dm.SuccessRateOfUnlockTreasureChest)
        {
            Debug.Log("宝箱の解除に失敗した"); /* あるいは鍵がかかっていないものも用意or成功率を宝箱ごとにわける */
            dm.MoveScene(E_DungeonScene.SelectAction);
            return;
        }

        switch (UnityEngine.Random.Range(0, 9))
        {
        case 0:
        case 1:
            DungeonActiveItem daItem = this.mayAppearDungeonActiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonActiveItems.Count)];
            Debug.Log(daItem.EffectName + "を入手した");
            dm.HaveDungeonActiveItems.Add(daItem);
            break;

        case 2:
        case 3:
            DungeonPassiveItem dpItem = this.mayAppearDungeonPassiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonPassiveItems.Count)];
            Debug.Log(dpItem.EffectName + "を入手した");
            dm.AddDungeonPassiveItem(dpItem);
            break;

        case 4:
        case 5:
            BattleActiveItem baItem = this.mayAppearBattleActiveItems[UnityEngine.Random.Range(0, this.mayAppearBattleActiveItems.Count)];
            Debug.Log(baItem.EffectName + "を入手した");
            dm.HaveBattleActiveItems.Add(baItem);
            break;

        case 6:
        case 7:
            BattlePassiveItem bpItem = this.mayAppearBattlePassiveItems[UnityEngine.Random.Range(0, this.mayAppearBattlePassiveItems.Count)];
            Debug.Log(bpItem.EffectName + "を入手した");
            dm.HaveBattlePassiveItems.Add(bpItem);
            break;

        case 8:
            BattleCharacter enemy = Instantiate(this.mayAppearEnemy[UnityEngine.Random.Range(0, this.mayAppearEnemy.Count)], dm.EnemysRootObject.transform);
            Debug.Log(enemy.CharaClass.CharaName + "が出現した");
            dm.Enemys = new List <BattleCharacter>()
            {
                enemy
            };
            dm.MoveBattleScene();
            return;
        }
        dm.ElapseTurn();
        dm.MoveScene(E_DungeonScene.SelectAction);
    }
예제 #3
0
    /// <summary>
    /// 宝箱を開ける処理。ランダムでアイテムかモンスター戦闘。(アイテム獲得処理は参照渡しのため修正が必要かも)
    /// </summary>
    /// <param name="dm">DungeonManager</param>
    private void OpenChest(DungeonManager dm)
    {
        switch (UnityEngine.Random.Range(0, 9))
        {
        case 0:
        case 1:
            DungeonActiveItem daItem = this.mayAppearDungeonActiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonActiveItems.Count)];
            Debug.Log(daItem.EffectName + "を入手した");
            dm.HaveDungeonActiveItems.Add(daItem);
            break;

        case 2:
        case 3:
            DungeonPassiveItem dpItem = this.mayAppearDungeonPassiveItems[UnityEngine.Random.Range(0, this.mayAppearDungeonPassiveItems.Count)];
            Debug.Log(dpItem.EffectName + "を入手した");
            dm.AddDungeonPassiveItem(dpItem);
            break;

        case 4:
        case 5:
            BattleActiveItem baItem = this.mayAppearBattleActiveItems[UnityEngine.Random.Range(0, this.mayAppearBattleActiveItems.Count)];
            Debug.Log(baItem.EffectName + "を入手した");
            dm.HaveBattleActiveItems.Add(baItem);
            break;

        case 6:
        case 7:
            BattlePassiveItem bpItem = this.mayAppearBattlePassiveItems[UnityEngine.Random.Range(0, this.mayAppearBattlePassiveItems.Count)];
            Debug.Log(bpItem.EffectName + "を入手した");
            dm.HaveBattlePassiveItems.Add(bpItem);
            break;

        case 8:
            BattleCharacter enemy = Instantiate(this.mayAppearEnemy[UnityEngine.Random.Range(0, this.mayAppearEnemy.Count)], dm.EnemysRootObject.transform);
            Debug.Log(enemy.CharaClass.CharaName + "が出現した");
            dm.Enemys = new List <BattleCharacter>()
            {
                enemy
            };
            dm.MoveBattleScene();
            return;
        }
        dm.ElapseTurn();
        dm.MoveScene(E_DungeonScene.SelectAction);
    }