Example #1
0
    public void CreateBeefjarkey(Character character, int deleteJakiCount)
    {
        //StageChip _stageChip;
        StageChip stageChip = Stage[character.data.path[0], character.data.path[1]];// GetStageChip (character);

        DeleteCharacter(character);

        Character beef = null;

        if (deleteJakiCount >= 15)
        {
            beef = Instantiate(CharaData.Jakis[3]);
        }
        if (deleteJakiCount >= 11)
        {
            beef = Instantiate(CharaData.Jakis[2]);
        }
        else if (deleteJakiCount >= 7)
        {
            beef = Instantiate(CharaData.Jakis[1]);
        }
        else
        {
            beef = Instantiate(CharaData.Jakis[0]);
        }

        if (beef == null)
        {
            return;
        }
        stageChip.AddCharacter(beef, true, 1.0f);

        beef.transform.SetParent(CharacterParent.transform);
    }
Example #2
0
 public void SetStageChip(StageChip _stageChip)
 {
     foreach (StageChip _output in Stage)
     {
         if (_output.gameObject == _stageChip.gameObject)
         {
             //_output = _stageChip;
             break;
         }
     }
 }
Example #3
0
    /// <summary>
    /// ステージの初期化・生成
    /// </summary>
    private StageChip[,] InitStage(bool isBack = false)
    {
        Vector2 InitStageSize = StageSize;

        //StageSize.x += offset.x;//右端に余白
        StageChip[,] stage = new StageChip[x, y];
        ////ステージの左上の場所を取得
        //Vector2 leftUpSide = new Vector2(-StageSize.x / 2, StageSize.y / 2) + DefaultPosition;//ステージ左上のポジションを取得
        ////マスの大きさを取得
        //Vector2 scale = new Vector2((StageSize.x / ((chipSze.x) * x + offset.x)), StageSize.y / (chipSze.x * y + offset.y));
        //float res = StageSize.x / (chipSze.x * x + offset.x * (x - 1));
        //Debug.Log(res);
        //scale.x = res;

        Vector2 leftUpSide = new Vector2(-StageSize.x / 2, StageSize.y / 2) + DefaultPosition;
        //Vector2 scale = new Vector2((InitStageSize.x / ((chipSze.x) * x + offset.x)), (InitStageSize.y / ((chipSze.y) * y + offset.y)));
        Vector2 scale = new Vector2((InitStageSize.x / ((chipSze.x) * x)), (InitStageSize.y / ((chipSze.y) * y)));

        GameObject parent;

        if (isBack)
        {
            leftUpSide.y += 1000;
            parent        = new GameObject("backGround");
        }
        else
        {
            parent = new GameObject("stage");
        }
        parent.transform.SetParent(transform);
        parent.transform.localPosition = Vector2.zero;
        Vector2 pos = leftUpSide;

        //マスを生成
        for (int i = 0; i < y; i++)
        {
            pos.x = leftUpSide.x + ((chipSze.x * scale.x) * 0.5f);
            for (int j = 0; j < x; j++)
            {
                stage[j, i] = Instantiate(StageChipPrefab, parent.transform);//StageChip.InitStageChip(data[j % data.Length]);
                Image image = stage[j, i].GetComponent <Image>();
                image.sprite     = data[(i + j) % data.Length];
                stage[j, i].path = new int[] { j, i };
                stage[j, i].transform.localPosition = pos;
                //次に配置するマスの位置を計算
                pos.x += chipSze.x * scale.x;// + offset.x;
                stage[j, i].transform.localScale = scale;
                stage[j, i].gameObject.SetActive(!isBack);
            }
            pos.y -= ((chipSze.y * scale.y));// + offset.y;
        }

        return(stage);
    }
Example #4
0
 private void OzisanInit()
 {
     while (OzisanCount < ConstData.OZISAN_INSTANCE_MAX)
     {
         bool      isBack = Random.Range(0, 2) == 0;
         int       x = Random.Range(0, Stage.GetLength(0)), y = Random.Range(0, Stage.GetLength(1));
         StageChip targetChip = (isBack ? backGroundStage : Stage)[x, y];
         if (targetChip.holdCharacter.data.m_DropType != DropType.ozisan)
         {
             DeleteCharacter(targetChip.holdCharacter);
             targetChip.AddCharacter(InitCharacter(OzisanPrefab, isBack), true);
         }
     }
 }
Example #5
0
    public StageChip GetStageChip(Character checkMapObj)
    {
        StageChip output = null;

        foreach (StageChip _output in Stage)
        {
            if (_output.holdCharacter && _output.holdCharacter == checkMapObj)
            {
                output = _output;
                break;
            }
        }

        return(output);
    }
Example #6
0
 /// <summary>
 /// このマスから他のマスにCharacterを動かす処理
 /// </summary>
 /// <param name="targetChip"></param>
 public void MoveCharacter(StageChip targetChip)
 {
     AddCharacter(targetChip.RemoveCharacter());
     //Debug.Log(Vector3.Lerp(_character.transform.position, targetChip.position, 0.5f));
 }