-
-
Save todorok1/b66807b0b6406f9e409df903582e44b6 to your computer and use it in GitHub Desktop.
シンプルRPGチュートリアル第64回 戦闘関連のスプライトを制御するクラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// 背景と敵キャラクターの位置をカメラに合わせて設定します。 | |
| /// </summary> | |
| public void SetSpritePosition() | |
| { | |
| if (_mainCamera == null) | |
| { | |
| _mainCamera = Camera.main; | |
| } | |
| var cameraPos = _mainCamera.transform.position; | |
| var newPosition = new Vector3(cameraPos.x, cameraPos.y, 0); | |
| var backgroundPosOffset = new Vector3(0, 0, 0); | |
| _backgroundRenderer.transform.position = newPosition + backgroundPosOffset; | |
| var enemyPosOffset = new Vector3(0, -0.5f, 0); | |
| _enenyRenderer.transform.position = newPosition + enemyPosOffset; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment