Beispiel #1
0
    private IEnumerator SetField(FieldSetValue fieldSetValue)
    {
        yield return(new WaitForSeconds(2.0f));

        for (int i = 0; i < walls.Length; i++)
        {
            walls[i].position = new Vector3(fieldSetValue.wallPos[i * 2], fieldSetValue.wallPos[i * 2 + 1], 0);
        }
        landforms[fieldSetValue.activeLandform].SetActive(true);
    }
Beispiel #2
0
    private void RpcSetField(FieldSetValue fieldSetValue)
    {
        // Client에서 Start()함수실행 후 Rpc가 실행되게 해야 함으로 Start()문을 대체해야하지만 임시로 코루틴
        StartCoroutine(SetField(fieldSetValue));

        /*
         * for (int i = 0; i < walls.Length; i++)
         * {
         *  walls[i].position = new Vector3(fieldSetValue.wallPos[i * 2], fieldSetValue.wallPos[i * 2 + 1], 0);
         * }
         *
         * Debug.Log("Landforms.Length : " + landforms.Length + "  fieldSetValue.ActiveLandform : " + fieldSetValue.activeLandform);
         * StartCoroutine(SetLandform(fieldSetValue.activeLandform));
         */
    }
Beispiel #3
0
        private static SetValue FieldValueSetterDelegate(FieldSetValue fieldSetter, Type typeOfField)
        {
            // The property/field setter function automatically converts an object returned by the DB
            // with a possible custom IUserType
            SetValue setValueFunc = (obj, val) =>
            {
                if (val == null)
                {
                    fieldSetter(obj, null);
                }
                else
                {
                    Type valType = val.GetType();
                    fieldSetter(obj, RegisteredCustomTypes.GetSystemObjectAfterCustomTypeConversion(val, typeOfField, valType));
                }
            };

            return(setValueFunc);
        }
Beispiel #4
0
    private void SetField()
    {
        // Botoom은 수직 이동 x
        walls[0].position += new Vector3(Random.Range(-maxTBx, maxTBx + 1), 0, 0);
        walls[1].position += new Vector3(Random.Range(-maxTBx, maxTBx + 1), Random.Range(0, maxTy), 0);

        // Left, Right wall의 y축 랜덤 최대값은 Top wall의 Y값 +15 이다.
        maxLRy             = (int)walls[1].localPosition.y + 15;
        walls[2].position += new Vector3(Random.Range(-maxLRx, 0), Random.Range(0, maxLRy), 0);
        walls[3].position += new Vector3(Random.Range(0, maxLRx + 1), Random.Range(0, maxLRy), 0);

        int ranLandform = Random.Range(0, landforms.Length);

        landforms[ranLandform].SetActive(true);

        FieldSetValue fieldSetValue = new FieldSetValue(walls, ranLandform);

        //NetworkInstanceId gridNetID = GameObject.Find("Grid").GetComponent<NetworkIdentity>().netId;

        RpcSetField(fieldSetValue);
    }