コード例 #1
0
        public void GetMaterial(int num, out Material _10, out Material _1)
        {
            _10 = null;
            _1  = null;

            DebugUtility.AssertFormat(num >= 0, "The num is less than zero: {0}", num);
            DebugUtility.AssertFormat(num < mNumMaterials.Length * 10 + mNumMaterials.Length, "The num[{0}] is not less than {1}", num, mNumMaterials.Length * 10 + mNumMaterials.Length);

            if (mNumMaterials.Length == 0)
            {
                DebugUtility.AssertFormat(false, "The ID Materials num is zero");
                return;
            }

            num = Mathf.Clamp(num, 0, mNumMaterials.Length * 10 + mNumMaterials.Length - 1);

            int value1  = num % 10;
            int value10 = (num - value1) / 10;

            if (mIDMaterials.Length > value10)
            {
                _10 = mNumMaterials[value10];
            }
            if (mIDMaterials.Length > value1)
            {
                _1 = mNumMaterials[value1];
            }
        }