Esempio n. 1
0
    static void BlockTrap(Player currentPlayer)
    {
        // 코인 수량 확보
        int coinValue = currentPlayer.coin.Value;

        // 코인 없으면 중단
        if (coinValue <= 0)
        {
            // 종료 판정
            isEnd = true;

            return;
        }

        // 코인 몰수
        currentPlayer.coin.subtract(coinValue);


        // 코인 아이템 인덱스
        int index = 1;


        // 오브젝트화
        //DynamicItem obj = GameData.itemManager.CreateItemObject(currentPlayer.movement.location, index, coinValue, ItemSlot.LoadIcon(Item.table[index]));
        DynamicItem obj = GameData.itemManager.CreateItemObject(currentPlayer.movement.location, index, coinValue);

        // 배치할 위치
        int loc = GameData.blockManager.indexLoop(currentPlayer.movement.location, -1);

        Debug.LogWarning("트랩 블록 : 날릴 위치 => " + loc);
        Vector3 pos = GameData.blockManager.GetBlock(loc).transform.position;


        // 아이템 날리기
        Tool.ThrowParabola(obj.transform, pos, liftY, 1f);

        // 오브젝트 재배치
        obj.RemoveBarricade();
        obj.location = loc;
        obj.CreateBarricade();

        // 장애물 등록
        //DynamicObject.objectList[loc]++;          // 생성시 자동 등록

        // 종료 판정 -> DynamicItem 에서 길과 충돌할때 처리
        //isEnd = true;
    }
Esempio n. 2
0
    public static void ReCreateAll(bool isDeleted)
    {
        Debug.LogError("아이템 오브젝트 :: 재생성 요청됨 => 총 " + itemObjectList.Count);

        // 백업
        List <DynamicItem> temp = itemObjectList;

        // 초기화
        itemObjectList = new List <DynamicItem>();

        // 반복 재생성
        for (int i = 0; i < temp.Count; i++)
        {
            DynamicItem dTemp = temp[i];

            // 리스트 및 장애물 제거
            //dTemp.Remove();
            dTemp.RemoveBarricade();

            // 생성
            DynamicItem dNew =
                GameMaster.script.itemManager.CreateItemObject(
                    dTemp.location,
                    dTemp.item.index,
                    dTemp.count
                    //dTemp.icon
                    );

            Tool.ThrowParabola(dNew.transform, dNew.transform.position, 2f, 1f);

            // 제거
            if (!isDeleted)
            {
                Destroy(dTemp.transform);
            }
        }
    }