我一直在研究无休止的平台生成器,但是我不知道如何在代码中使用十进制数。我一直在尝试使用private double或private decimal,但我没有搞清楚。这是我的代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlatformManager : MonoBehaviour
{
[SerializeField]
private GameObject[] _platformPrefabs;
[SerializeField]
private int _zedOffset;
private int _yOffset;
// Start is called before the first frame update
void Start()
{
for (int i = 0; 1 < _platformPrefabs.Length; i++)
{
global::System.Object value = Instantiate(_platformPrefabs[i], new Vector3(0, i * -24.8, i * -30), Quaternion.Euler(0, 90, 0));
_zedOffset += -30;
_yOffset += -24.8;
}
}
public void RecyclePlatform(GameObject platform)
{
platform.transform.position = new Vector3(0, _yOffset, _zedOffset);
_zedOffset += -30;
_yOffset += -24.8;
}
}发布于 2022-08-19 11:30:27
你需要使用浮点数
专用浮子_myFloat;
_myFloat = 1.23f;
https://stackoverflow.com/questions/73415837
复制相似问题