「Unity/おすすめアセット/ビル群」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「 ==ビル群== https://ghoul-life.hatenablog.com/entry/2019/02/27/200305 ==範囲調整== BuildingMapCreater.cs <pre> private int MAP_SIZE_W = 500; private int M...」) |
(→ビルをローカル座標に設置) |
||
| 行16: | 行16: | ||
- this.transform.position = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z); | - this.transform.position = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z); | ||
+ this.transform.localPosition = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z); | + this.transform.localPosition = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z); | ||
| + | </pre> | ||
| + | |||
| + | ===ビルが伸びるアニメーション削除=== | ||
| + | Stage.stage | ||
| + | <pre> | ||
| + | - StartCoroutine(_CreateMap()); | ||
| + | + _CreateMap(); | ||
| + | |||
| + | - private IEnumerator _CreateMap() | ||
| + | + private void _CreateMap() | ||
| + | |||
| + | - yield return new WaitForEndOfFrame(); | ||
| + | </pre> | ||
| + | |||
| + | Building.csの以下削除 | ||
| + | <pre> | ||
| + | void Update() | ||
| + | { | ||
| + | if (_isInitialize) | ||
| + | { | ||
| + | if (Vector3.Distance(this.transform.position, _targetPosition) > 0.01f) | ||
| + | { | ||
| + | this.transform.position = Vector3.MoveTowards(this.transform.position, _targetPosition, INIT_TIME * Time.deltaTime); | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | this.transform.position = _targetPosition; | ||
| + | _isInitialize = false; | ||
| + | } | ||
| + | } | ||
| + | } | ||
</pre> | </pre> | ||
2022年3月31日 (木) 00:31時点における版
ビル群
https://ghoul-life.hatenablog.com/entry/2019/02/27/200305
範囲調整
BuildingMapCreater.cs
private int MAP_SIZE_W = 500;
private int MAP_SIZE_H = 100;
ビルをローカル座標に設置
Building.cs
- this.transform.position = _targetPosition; + this.transform.localPosition = _targetPosition; - this.transform.position = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z); + this.transform.localPosition = new Vector3(_targetPosition.x, _targetPosition.y - mapObjectData.scale.y, _targetPosition.z);
ビルが伸びるアニメーション削除
Stage.stage
- StartCoroutine(_CreateMap()); + _CreateMap(); - private IEnumerator _CreateMap() + private void _CreateMap() - yield return new WaitForEndOfFrame();
Building.csの以下削除
void Update()
{
if (_isInitialize)
{
if (Vector3.Distance(this.transform.position, _targetPosition) > 0.01f)
{
this.transform.position = Vector3.MoveTowards(this.transform.position, _targetPosition, INIT_TIME * Time.deltaTime);
}
else
{
this.transform.position = _targetPosition;
_isInitialize = false;
}
}
}
=ビルに霧追加
- Unityメインメニュー/Window/Rendering/Lighting/Environmentへ
- Fogをonへ
- Fog/Colorを薄青へ
- Fog/ModeをExponentialSquaredからExponentialへ
