Replace TownSquare with HomeCamp art and land humanoid bots, LittleBear, and LmGirl review assets.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -323,15 +323,49 @@ public static class BuildPrototype
|
||||
try
|
||||
{
|
||||
var root = new GameObject("PortraitRoot"); SceneManager.MoveGameObjectToScene(root, scene);
|
||||
Pet(id, root.transform, "PortraitPet");
|
||||
var camera = Group("PortraitCamera", root.transform).gameObject.AddComponent<Camera>(); camera.scene = scene;
|
||||
camera.clearFlags = CameraClearFlags.SolidColor; camera.backgroundColor = Color.clear; camera.cullingMask = 1 << 30;
|
||||
bool primitiveBird = id == 3 && !FormalPets.ContainsKey(id);
|
||||
camera.orthographic = true; camera.orthographicSize = primitiveBird ? 1.22f : id >= 9 ? 1.34f : 1.08f; camera.allowHDR = false;
|
||||
camera.transform.position = new Vector3(1.6f, 1.55f, -4); camera.transform.LookAt(new Vector3(0, primitiveBird ? .94f : id >= 5 ? .86f : .82f, 0)); camera.targetTexture = rt;
|
||||
var light = Group("PortraitLight", root.transform).gameObject.AddComponent<Light>(); light.type = LightType.Directional;
|
||||
light.intensity = 1.15f; light.cullingMask = 1 << 30; light.transform.rotation = Quaternion.Euler(35, -35, 0);
|
||||
camera.Render(); RenderTexture.active = rt;
|
||||
bool formal = FormalPets.TryGetValue(id, out var prefabPath) && AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath) != null;
|
||||
if (formal)
|
||||
{
|
||||
var instance = (GameObject)PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath), root.transform);
|
||||
instance.transform.localPosition = Vector3.zero;
|
||||
instance.transform.localRotation = Quaternion.Euler(0, 18f, 0);
|
||||
foreach (var trans in root.GetComponentsInChildren<Transform>(true)) trans.gameObject.layer = 30;
|
||||
var renderers = instance.GetComponentsInChildren<Renderer>(true);
|
||||
Bounds bounds = new Bounds(instance.transform.position, Vector3.zero);
|
||||
bool hasBounds = false;
|
||||
foreach (var r in renderers)
|
||||
{
|
||||
if (r is ParticleSystemRenderer) continue;
|
||||
if (!hasBounds) { bounds = r.bounds; hasBounds = true; } else bounds.Encapsulate(r.bounds);
|
||||
}
|
||||
var camera = Group("PortraitCamera", root.transform).gameObject.AddComponent<Camera>(); camera.scene = scene;
|
||||
camera.clearFlags = CameraClearFlags.SolidColor; camera.backgroundColor = Color.clear; camera.cullingMask = 1 << 30;
|
||||
camera.orthographic = true; camera.allowHDR = false; camera.targetTexture = rt;
|
||||
float maxDim = Mathf.Max(bounds.size.x, bounds.size.y);
|
||||
camera.orthographicSize = (maxDim * 0.5f) * 1.15f;
|
||||
Vector3 target = bounds.center + Vector3.up * (bounds.size.y * 0.04f);
|
||||
camera.transform.position = target + new Vector3(0, maxDim * 0.22f, -3.5f);
|
||||
camera.transform.LookAt(target);
|
||||
|
||||
var keyLight = Group("PortraitLight", root.transform).gameObject.AddComponent<Light>(); keyLight.type = LightType.Directional;
|
||||
keyLight.color = new Color(1f, 0.96f, 0.92f); keyLight.intensity = 1.35f; keyLight.cullingMask = 1 << 30; keyLight.transform.rotation = Quaternion.Euler(28, -25, 0);
|
||||
|
||||
var rimLight = Group("PortraitRim", root.transform).gameObject.AddComponent<Light>(); rimLight.type = LightType.Directional;
|
||||
rimLight.color = new Color(0.85f, 0.92f, 1f); rimLight.intensity = 0.85f; rimLight.cullingMask = 1 << 30; rimLight.transform.rotation = Quaternion.Euler(-20, 150, 0);
|
||||
camera.Render();
|
||||
}
|
||||
else
|
||||
{
|
||||
Pet(id, root.transform, "PortraitPet");
|
||||
var camera = Group("PortraitCamera", root.transform).gameObject.AddComponent<Camera>(); camera.scene = scene;
|
||||
camera.clearFlags = CameraClearFlags.SolidColor; camera.backgroundColor = Color.clear; camera.cullingMask = 1 << 30;
|
||||
bool primitiveBird = id == 3 && !FormalPets.ContainsKey(id);
|
||||
camera.orthographic = true; camera.orthographicSize = primitiveBird ? 1.22f : id >= 9 ? 1.34f : 1.08f; camera.allowHDR = false;
|
||||
camera.transform.position = new Vector3(1.6f, 1.55f, -4); camera.transform.LookAt(new Vector3(0, primitiveBird ? .94f : id >= 5 ? .86f : .82f, 0)); camera.targetTexture = rt;
|
||||
var light = Group("PortraitLight", root.transform).gameObject.AddComponent<Light>(); light.type = LightType.Directional;
|
||||
light.intensity = 1.15f; light.cullingMask = 1 << 30; light.transform.rotation = Quaternion.Euler(35, -35, 0);
|
||||
camera.Render();
|
||||
} RenderTexture.active = rt;
|
||||
var texture = new Texture2D(256, 256, TextureFormat.RGBA32, false);
|
||||
try { texture.ReadPixels(new Rect(0, 0, 256, 256), 0, 0); texture.Apply(); File.WriteAllBytes(Pictures + "/proto_pet_" + id + ".png", texture.EncodeToPNG()); }
|
||||
finally { UnityEngine.Object.DestroyImmediate(texture); }
|
||||
|
||||
Reference in New Issue
Block a user