예제 #1
0
 void CheckDiceNum() //ダイスの面を一つづつ調べてdiceNumに保存
 {
     for (int i = 0; i < spawnDice.dices.Length; i++)
     {
         die = spawnDice.dices[i].GetComponent <Die_d6>();
         diceNum.Add(die.value);
     }
 }
예제 #2
0
    public void diceFunction()
    {
        isButtons = false;
        dice      = Instantiate(dicePrefab) as GameObject;
        dice.transform.position   = box.transform.position + Vector3.up * 0.7f;
        dice.transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
        die_d6 = dice.GetComponent <Die_d6> ();
        dice.transform.rotation = Random.rotation;

        isDice = true;
    }
예제 #3
0
    void DeleteDice() //2つ以上ある数字のサイコロを検索して削除
    {
        musicManeger.DeleteSound();
        for (int i = 0; i < spawnDice.dices.Length; i++)
        {
            die = spawnDice.dices[i].GetComponent <Die_d6>();
            for (int t = 0; t < deleteNum.Count; t++)
            {
                if (deleteNum[t] == die.value)
                {
                    Destroy(spawnDice.dices[i]);
                }
            }
        }

        //deleteNumの削除
        deleteNum.Clear();
    }
예제 #4
0
 void Start()
 {
     _Point     = new Transform[3];
     _EnemyDice = new Die_d6[3];
     foreach (Die_d6 element in _EnemyDice)
     {
         _EnemyDice[_cout] = Instantiate(_EnemyDicePref, _EnemyTransform[_cout].position, _EnemyTransform[_cout].rotation = Random.rotation);
         _cout++;
     }
     foreach (Transform element in _PointEnd)
     {
         _Point[_coutn] = element;
         _coutn++;
     }
     _FirstDice           = Instantiate(_PlayerDice[0], _PlayerTransform[0].position, _PlayerTransform[0].rotation = Random.rotation);
     _SecondDice          = Instantiate(_PlayerDice[1], _PlayerTransform[1].position, _PlayerTransform[1].rotation = Random.rotation);
     _ThirdDice           = Instantiate(_PlayerDice[2], _PlayerTransform[2].position, _PlayerTransform[2].rotation = Random.rotation);
     _FirstDice._point    = 0;
     _SecondDice._point   = 1;
     _ThirdDice._point    = 2;
     _FirstDice._ischange = true;
 }
예제 #5
0
    void ZeroCheck()
    {
        //Debug.Log("ZERO");
        for (int i = 0; i < dices.Length; i++)
        {
            //目が0(判定不能)かだけ調べる
            zeroOrNot = dices[i].GetComponent <Die_d6>();
            if (zeroOrNot.value == 0)
            {
                zeroDices.Add(dices[i]);
                zero = true;
            }

            //ステージ外か調べる
            outCheck = dices[i].transform.position;
            if (outCheck.x < -15 || outCheck.x > 15)
            {
                Destroy(dices[i]);
                destroyDice = true;
            }
        }
        if (destroyDice)
        {
            destroyDice = false;
            Invoke("FindDices", 1);
        }
        else if (zero)
        {
            ReRoll();
        }
        else
        {
            ready = true;
            diceCheck.CheckingDice();
        }
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     //最初にランダムで回転させる
     transform.rotation = Random.rotation;
     die = gameObject.GetComponent <Die_d6>();
 }
예제 #7
0
    //	returns previous child that was in the slot, if any
    public override GameObject OnAddChild(GameObject child)
    {
        GameObject prevChild = null;

        if (child.transform.parent != null)
        {
            GameObject parentGO        = child.transform.parent.gameObject;
            Container  parentContainer = parentGO.GetComponent <Container>();
            if (parentContainer != this)
            {
                prevChild = parentContainer.removeChild(child);
            }
        }
        //base.OnAddChild(child);
        if (moveSlotToChild)
        {
            this.transform.position = child.transform.position;
            this.transform.rotation = child.transform.rotation;
        }

        if (scaleChild)
        {
            child.transform.localScale = Vector3.one;                           //	allows the slot scale to scale the child as well.
        }
        if (moveChild)
        {
            if (animateMove)                    //	we need to set the position to be where we currently are after we have this slot as the new parent. Then we will interpolate to zero directly on top of the slot.
            //Rigidbody rb = child.GetComponent<Rigidbody>();
            //rb.detectCollisions = false;
            //child.transform.localPosition = Vector3.zero;	//	put the child on top of the parent.
            {
                iTween.MoveToLocal(child.gameObject, Vector3.zero, animTime);
                //	break child/parent relationship then reconnect it
                //GameObject parentGO = child.transform.parent.gameObject;
                //child.transform.parent = null;
                //iTween.MoveTo (child.gameObject, this.transform.position, 3.0f);
            }
            else
            {
                child.transform.localPosition = Vector3.zero;                   //	put the child on top of the parent.
            }
        }
        if (orientChild)
        {
            Die_d6 die = child.GetComponent <Die_d6> ();
            if (die != null)
            {
                //Rigidbody rb = die.GetComponent<Rigidbody>();
                //rb.detectCollisions = false;
                die.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
                die.OrientTowardLinedUp();
            }
            else
            {
                child.transform.localRotation = Quaternion.identity;                            //	allows the slot scale to rotate the child as well.
            }
        }

        /*
         * if (curState >= 0) {
         *      PositionToggler tglr = GetComponent<PositionToggler>();
         *      if (tglr != null) {
         *              tglr.SetState(curState);
         *      }
         * }
         */
        return(prevChild);
    }