Ejemplo n.º 1
0
    //回転柱設定
    public GameObject CreateTurnPiller(int side, int height, int size)
    {
        //柱位置計算
        side = CalPillerid(side);
        Quaternion move = CalQuaternion(side, piller.Aroundnum);
        Vector3    posi = CalPosition(move, DefaultPosition, height);

        //オブジェクト作成
        GameObject obj = Instantiate(turnpiller.PillerPrefub);

        obj.name               = "Turn" + side + "_" + height;
        obj.transform.parent   = piller.FieldPiller[side].gameObject.transform;
        obj.transform.position = posi;
        obj.GetComponent <CapsuleCollider>().height = size * 2.0f;
        Field field = obj.GetComponent <Field>();

        field.FallFlag  = false;
        field.nowHeight = height;
        field.nowPiller = side;
        TurnPiller turnPiller = obj.GetComponent <TurnPiller>();

        turnPiller.size = size;


        turnpiller.SetPiller(obj, side, height);

        return(obj);
    }
Ejemplo n.º 2
0
    //回転処理セット
    private void SetReverse()
    {
        GameObject obj = turnpillermane.StartReverse(field.nowPiller, field.nowHeight);

        if (obj != null)
        {
            turnpiller = obj.GetComponent <TurnPiller>();
            this.GetComponent <Rigidbody>().isKinematic = true;
            NowInput = INPUT_REVERSE;
        }
    }
Ejemplo n.º 3
0
    //回転できるやつがあったら回転開始
    public GameObject StartReverse(int pillerid, int height)
    {
        GameObject obj  = null;
        bool       flag = false;

        for (int i = 0; i < Piller.Count; i++)
        {
            //データ受け取る
            Field      field      = Piller[i].GetComponent <Field>();
            TurnPiller turnPiller = Piller[i].GetComponent <TurnPiller>();

            //同じ柱ない場合
            if (field.nowPiller != pillerid)
            {
                if (flag)
                {
                    break;
                }
                continue;
            }
            else if (!flag)
            {
                flag = true;
            }


            //同じ柱でなおかつ柱の範囲にいるか
            int ereamax = field.nowHeight + turnPiller.size - 1;
            int ereamin = field.nowHeight - turnPiller.size;
            if (ereamax >= height && ereamin <= height)
            {
                //すでに見つけてる高さより小さい場合は入れ替える
                if (obj == null)
                {
                    obj = Piller[i];
                }
                else if (obj.GetComponent <Field>().nowHeight > field.nowHeight)
                {
                    obj = Piller[i];
                }
            }
        }

        if (obj != null)
        {
            obj.GetComponent <TurnPiller>().ReverseStart(true);
        }
        return(obj);
    }