Exemplo n.º 1
0
    //
    public void ShowItem(Transform tf)
    {
        GameObject item = GetItem();

        if (MyUtility.IsNull(item, "Item") == true)
        {
            return;
        }
        //
        int itemKey = MyUtility.GetValueFromRates(itemRates);

        Item.ItemType type = (Item.ItemType)itemKey;
        // Item.ItemType type = (Item.ItemType)listItemOrder[order];
        //
        item.SetActive(true);
        item.GetComponent <Item>().SetItem(type);
        //
        item.transform.SetParent(tf);
        item.transform.localPosition = Vector3.zero;
        //
        //order++;
        //if (order == cItemOrderCount)
        //{
        //    order = 0;
        //    MyUtility.ShuffleList(listItemOrder);
        //}
    }
Exemplo n.º 2
0
 //=============================================//
 private void SetDir()
 {
     if (MyUtility.IsNull(playerTF, name))
     {
         return;
     }
     //
     dirToPlayer = (playerTF.position - tf.position);
     //
     sr.flipX = (rb.velocity.x >= 0); // 이동 기준
     //rend.flipX = (dirToPlayer.x >= 0); // 힘 기준
 }
Exemplo n.º 3
0
 //
 public void AddAJPack()
 {
     if (airJumpCount == 0)
     {
         AirJumpPack jumpPack = ItemManager.instance.GetJumpPack();
         if (MyUtility.IsNull(jumpPack, "JumpPack"))
         {
             return;
         }
         //
         dummy.arm.EquipJumpPack(true, jumpPack);
     }
     //
     ++airJumpCount;
     UpdateAirJumpText();
 }
Exemplo n.º 4
0
    ///////////////////////////////////////
    public void SetMine(Block block)
    {
        // Debug.Log("SetMine : Begin");
        //
        StageData sd = currentStageData;

        if (MyUtility.IsNull(sd, "StageData"))
        {
            return;
        }
        //
        int[] mineArr;
        { // Crate Mine Array
            int[] mines = { sd.pull, sd.push, sd.ghost, sd.thunder, sd.narrow };
            //
            int totalCount = 0;
            for (int i = 0; i < mines.Length; ++i)
            {
                totalCount += mines[i];
            }
            //
            mineArr = new int[totalCount];
            int idx = 0;
            for (int i = 0; i < mines.Length; ++i)
            {
                for (int j = 0; j < mines[i]; ++j)
                {
                    mineArr[idx++] = i;
                }
            }
        }
        int floorCount = block.floors.Count, tileCount = block.GetFloor(0).tiles.Count;

        // Set Crash Mine First
        if (sd.crash > 0)
        {
            Tile t;
            int  randTileIdx = 0;
            //
            if (sd.crash == 1)
            {
                int randFloor = Random.Range(0, floorCount); // 0 ~ 9
                randTileIdx = Random.Range(0, tileCount);
                t           = block.GetFloor(randFloor).tiles[randTileIdx].GetComponent <Tile>();
                t.inner.SetDanger((int)MineTypes.CRASH);
            }
            if (sd.crash == 2)
            {
                int oddFloor = (Random.Range(0, floorCount / 2) * 2) + 0; // 0, 2, 4, 6, 8
                int eveFloor = (Random.Range(0, floorCount / 2) * 2) + 1; // 1, 3, 5, 7, 9
                                                                          //
                randTileIdx = Random.Range(0, 6);
                t           = block.GetFloor(oddFloor).tiles[randTileIdx].GetComponent <Tile>();
                t.inner.SetDanger(5);
                //
                randTileIdx = Random.Range(0, 6);
                t           = block.GetFloor(eveFloor).tiles[randTileIdx].GetComponent <Tile>();
                t.inner.SetDanger(5);
            }
        }
        //

        // Get All Tiles
        List <Tile> allTiles = new List <Tile>();

        for (int i = 0; i < floorCount; ++i)
        {
            for (int j = 0; j < tileCount; ++j)
            {
                Tile t = block.GetFloor(i).tiles[j].GetComponent <Tile>();
                // pass crash mine
                if (t.inner.isDanger == true)
                {
                    continue;
                }
                //
                allTiles.Add(t);
            }
        }
        // Shuffle All Tiles Be Set
        MyUtility.ShuffleList(allTiles);
        // Shuffle Mines To Set
        MyUtility.ShuffleArray(mineArr);
        // Set Mine
        for (int i = 0; i < mineArr.Length; ++i)
        {
            allTiles[i].inner.SetDanger(mineArr[i]);
        }
        //
        // Debug.Log("SetMine : End");
    }