「Unity/おすすめアセット/ビル群」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「 ==ビル群== https://ghoul-life.hatenablog.com/entry/2019/02/27/200305 ==範囲調整== BuildingMapCreater.cs <pre> private int MAP_SIZE_W = 500; private int M...」) |
(→ビルに霧追加) |
||
| (同じ利用者による、間の2版が非表示) | |||
| 行18: | 行18: | ||
</pre> | </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> | ||
| + | |||
| + | ===ビルに霧追加=== | ||
#Unityメインメニュー/Window/Rendering/Lighting/Environmentへ | #Unityメインメニュー/Window/Rendering/Lighting/Environmentへ | ||
#Fogをonへ | #Fogをonへ | ||
#Fog/Colorを薄青へ | #Fog/Colorを薄青へ | ||
#Fog/ModeをExponentialSquaredからExponentialへ | #Fog/ModeをExponentialSquaredからExponentialへ | ||
| + | |||
| + | ==スマホで扱うと重い== | ||
| + | ので、プレイ画面のオブジェクトをコピーして、静止オブジェクトに貼り付けたほうが良いかも | ||
| + | #BuildingCubeをコピーして、 | ||
| + | #貼り付けたオブジェクトのInspectorからBuilding.csのアクティブをoffへ | ||
2022年7月4日 (月) 11:57時点における最新版
ビル群
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へ
スマホで扱うと重い
ので、プレイ画面のオブジェクトをコピーして、静止オブジェクトに貼り付けたほうが良いかも
- BuildingCubeをコピーして、
- 貼り付けたオブジェクトのInspectorからBuilding.csのアクティブをoffへ
