コード例 #1
0
    public void SpawnDrop()
    {
        var drop = dropTable.Drop();

        if (drop)
        {
            Instantiate(drop, transform.position, Quaternion.identity);
        }
    }
コード例 #2
0
    public GameObject Drop()
    {
        GameObject drop = dropTable.Drop();

        if (drop != null)
        {
            drop = ObjectPoolsManager.GetInstance().GetObject(drop);
            drop.transform.position = transform.position;
        }
        return(drop);
    }
コード例 #3
0
    static void BlockLuckyBox(Player currentPlayer)
    {
        // 럭키박스 드랍테이블
        DropTable dropTable = new DropTable();

        // 드랍테이블 셋팅
        dropTable.rare = new List <int>();
        for (int i = 1; i < LuckyBox.table.Count; i++)
        {
            dropTable.rare.Add(LuckyBox.table[i].rare);
            Debug.Log("드랍 테이블 :: 추가됨 -> " + LuckyBox.table[i].rare);
        }
        Debug.LogWarning("드랍 테이블 :: 목록 총량 ->" + dropTable.rare.Count);

        // 드랍 테이블 작동 및 드랍대상 인덱스 확보
        int select = 1 + dropTable.Drop();

        Debug.LogWarning("럭키박스 :: 선택됨 -> " + select);

        // 테스트용 드랍 조작===================== 테스트 후 삭제할것
        select = 17;

        // 럭키박스 연출 시작
        LuckyBoxManager lbm = LuckyBoxManager.script;

        // 강제 초기화
        lbm.ClearForced();

        // 소환
        lbm.GetLuckyBox(currentPlayer);

        // 오픈
        lbm.Open();

        // 코루틴 초기화
        if (lbm.coroutineOpen != null)
        {
            lbm.StopCoroutine(lbm.coroutineOpen);
        }
        // 대기, 결과 출력, 효과 적용, 종료 판정
        lbm.coroutineOpen = lbm.StartCoroutine(lbm.WaitAndResult(LuckyBox.table[select], currentPlayer));

        // 스트링 입력
        lbm.SetTextByIndex(select);
    }
コード例 #4
0
    public void Complete()
    {
        m_rewardTable.Drop(m_player.m_inventory);
        m_player.m_currentQuests.Remove(this);
        m_player.m_completedQuests.Add(this);

        // assigned dynamically to reduce generation times and to improve accuracy
        if (m_nextQuests.Count > 0)
        {
            foreach (string next in m_nextQuests)            // 0 for now, just make it so last hand in is singular
            {
                if (!m_currentNPCs[0].m_questsAvailable.Contains(next))
                {
                    m_currentNPCs[0].m_questsAvailable.Add(next);
                }
            }
        }
    }
コード例 #5
0
 public override void Execute(GameObject obj)
 {
     if (dropTable)
     {
         GameObject drop = dropTable.Drop();
         if (drop)
         {
             Poolable poolable = drop.GetComponent <Poolable> ();
             if (poolable)
             {
                 drop = poolable.GetInstance();
             }
             else
             {
                 drop = Instantiate(drop);
             }
             drop.transform.position = obj.transform.position;
         }
     }
 }
コード例 #6
0
    static void BlockShop(Player currentPlayer)
    {
        // 아이템번들 드랍테이블
        DropTable dropTable = new DropTable();

        // 첫번째 아이템 인댁스 (레이블과 코인 제외 => 2)
        int first = 2;

        // 드랍테이블 셋팅
        dropTable.rare = new List <int>();
        Debug.LogWarning("드랍 테이블 :: 목록 총량 ->" + Item.table.Count);
        for (int i = first; i < Item.table.Count; i++)
        {
            dropTable.rare.Add(Item.table[i].rare);
            Debug.Log("드랍 테이블 :: 추가됨 -> " + Item.table[i].rare);
        }


        // 드랍 테이블 작동
        List <int> select = dropTable.Drop(ItemShop.script.bundle.Count);

        // 아이템 상점 갱신
        for (int i = 0; i < ItemShop.script.bundle.Count; i++)
        {
            int trueIndex = select[i] + first;

            // 드랍 테이블 작동
            Debug.LogWarning("아이템 상점 :: 추가됨 -> " + trueIndex);

            // 아이템 번들 등록
            ItemShop.script.SetItemBundle(i, Item.table[trueIndex]);
        }

        // UI 출력
        //GameMaster.script.messageBox.PopUp(true, true, true, MessageBox.Type.Itemshop);
        GameMaster.script.messageBox.PopUp(MessageBox.Type.Itemshop);


        // 종료판정은 UI에서 버튼 클릭으로 처리됨
    }
コード例 #7
0
    /// <summary>
    /// 럭키박스 효과
    /// </summary>
    /// <param name="__luckyBox"></param>
    /// <param name="user">작동자</param>
    /// <param name="filteredTarget">효과 대상</param>
    /// <returns></returns>
    public static IEnumerator EachEffect(LuckyBox __luckyBox, Player user, List <Player> filteredTarget)
    {
        switch (__luckyBox.index)
        {
        // 필요시 추가

        case 0:
            // 0번은 없음
            break;

        case 16:
            // 선인장 도적단
        {
            // 잘못된 인원수 차단
            if (filteredTarget.Count == 0)
            {
                break;
            }

            // 연출
            // 미구현=============

            ItemSlot slot = null;
            for (int i = 0; i < filteredTarget.Count; i++)
            {
                // 아이템 없으면 중단
                if (filteredTarget[i].inventoryCount <= 0)
                {
                    break;
                }

                // 가져올 아이템 지정
                slot = filteredTarget[i].inventory[0];

                // 강탈
                filteredTarget[i].RemoveItem(slot);
            }
        }

        break;

        case 17:
            // 중립 몬스터 돌격
        {
            // 돌진 명령 - 자동화
            yield return(MonsterManager.script.Dash(user.location, __luckyBox.effect.where));

            // 수동화 - 사용 안함
            {
                //// 소환
                //MonsterManager.script.Call(user.location);

                //// 애니메이션 작동
                //MonsterManager.script.Work();

                //// 카메라 포커싱
                //MonsterManager.script.Focus();

                //// 돌진 명령
                //yield return MonsterManager.script.DashOnly(__luckyBox.effect.where);

                //// 몬스터 숨김
                //MonsterManager.script.Hide();
            }


            // 구 코드 - 폐기 예정
            {
                /*
                 *
                 * // 생성 위치
                 * int blockIndex = 0;
                 *
                 * // 플레이어 지정시 위치 확보
                 * if (user != null)
                 *  blockIndex = user.location;
                 *
                 *
                 *
                 * // 제어자 퀵등록
                 * Player world = Player.system.World;
                 *
                 * // 백업
                 * GameObject backAvatar = world.avatar;
                 * Transform backAvatarBody = world.avatarBody;
                 * //CharacterMover backMovement = avatar.movement;
                 *
                 * // 생성할 몬스터
                 * // 미구현==================== 프리팹 지정할것
                 * GameObject obj = null;
                 *
                 * // 생성 및 등록=================프리팹 지정 안되어서 널 오류 발생
                 * world.avatar = GameObject.Instantiate(
                 *  obj,
                 *  BlockManager.script.startBlock
                 *  ) as GameObject;
                 * world.avatarBody = world.avatar.transform.Find("BodyObject");
                 *
                 * // 이동제어 셋업
                 * CharacterMover movement = world.avatar.GetComponent<CharacterMover>();
                 * movement.owner = world;
                 *
                 * // 퀵등록
                 * Transform monster = world.avatar.transform;
                 *
                 * // 초기위치 설정
                 * if (user.location != -1)
                 *  movement.location = user.location;
                 *
                 * // 위치 적용
                 * monster.position = user.avatar.transform.position;
                 *
                 *
                 * // 카메라 부착
                 * GameData.worldManager.cameraManager.CamMoveTo(monster, CameraManager.CamAngle.Top);
                 *
                 * // 돌진 계획
                 * movement.PlanMoveBy(__luckyBox.effect.where);
                 *
                 *
                 * // 잔여 액션 있음 or 액션 수행중 경우
                 * while (movement.actionsQueue.Count > 0 || movement.actNow.type == Action.ActionType.None)
                 * {
                 *  movement.ActionCall();
                 * }
                 *
                 *
                 *
                 *
                 * // 복구
                 * world.avatar = backAvatar;
                 * world.avatarBody = backAvatarBody;
                 *
                 * // 할당 해제
                 * movement = null;
                 *
                 * // 몬스터 제거
                 * Transform.Destroy(monster);
                 *
                 */
            }

            // 카메라 탈착
            GameData.worldManager.cameraManager.CamMoveTo(Turn.now.avatar.transform, CameraManager.CamAngle.Top);
            //GameData.worldManager.cameraManager.CamFree();
        }
        break;

        case 20:
            // 럭키 아이템
        {
            // 럭키박스 드랍테이블
            DropTable dropTable = new DropTable();

            // 드랍테이블 셋팅
            dropTable.rare = new List <int>();
            for (int i = 0; i < Item.tableLuckyDrop.Count; i++)
            {
                dropTable.rare.Add(Item.tableLuckyDrop[i].rare);
                Debug.Log("드랍 테이블 :: 추가됨 -> " + Item.tableLuckyDrop[i].rare);
            }
            Debug.LogWarning("드랍 테이블 :: 목록 총량 ->" + dropTable.rare.Count);

            int select = dropTable.Drop();
            Debug.LogWarning("럭키 아이템 :: 선택됨 -> " + Item.tableLuckyDrop[select].name);

            // 지급
            user.AddItem(Item.tableLuckyDrop[select], 1);
        }
        break;

        case 21:
            // 공공의 적
        {
            // 코인 최다 플레이어
            List <Player> best    = new List <Player>();
            Player        current = null;

            for (int i = 0; i < user.otherPlayers.Count; i++)
            {
                current = user.otherPlayers[i];

                // 비교대상 없을 경우 즉시 지정
                if (best.Count == 0)
                {
                    best.Add(current);
                }

                // 코인 더 많을 경우 지정
                else if (current.coin.Value > best[0].coin.Value)
                {
                    best.Clear();
                    best.Add(current);
                }

                // 같을 경우
                else if (current.coin.Value == best[0].coin.Value)
                {
                    best.Add(current);
                }
            }

            // 코인 강탈
            for (int i = 0; i < best.Count; i++)
            {
                best[i].coin.subtract(__luckyBox.effect.value / best.Count);
            }

            // 코인 지급
            user.coin.Add(__luckyBox.effect.value);
        }
        break;

        case 22:
            // 코인 최다 플레이어
        {
            List <Player> least   = new List <Player>();
            Player        current = null;

            for (int i = 0; i < user.otherPlayers.Count; i++)
            {
                current = user.otherPlayers[i];

                // 비교대상 없을 경우 즉시 지정
                if (least.Count == 0)
                {
                    least.Add(current);
                }

                // 코인 더 적을 경우 지정
                else if (current.coin.Value < least[0].coin.Value)
                {
                    least.Clear();
                    least.Add(current);
                }

                // 같을 경우
                else if (current.coin.Value == least[0].coin.Value)
                {
                    least.Add(current);
                }
            }

            // 코인 강탈
            user.coin.subtract(__luckyBox.effect.value);

            // 코인 지급
            for (int i = 0; i < least.Count; i++)
            {
                least[i].coin.Add(__luckyBox.effect.value / least.Count);
            }
        }
        break;
        }

        yield return(null);
    }