Add AntMan scaling, ghost trail and test prefab
Introduce a set of test tools and demo assets for an AntMan-style scaling effect: - Add AntManScaleController: handles smooth scale transitions (absolute/relative modes), pivot preservation, queued toggles and events. - Add GhostTrailEmitter and GhostTrailGhost: spawn fading ghost meshes (supports skinned mesh baking, material fallback, lifetime and pooling limit). - Add GKTInventoryScaleToggle: inventory-gated input wrapper to toggle scale with optional Ctrl bypass and auto reference resolution. - Add AntManTestSceneBootstrap and TestBootstrap prefab to quickly construct a test scene (cube, light, camera) with components configured. - Add AntManScaleTest scene and related prefab/meta files, plus .vsconfig for Unity workload. - Update SampleScene LFS pointer (scene file checksum/size). These changes provide a reusable demo and components to test scaling visuals and interactions during development.
This commit is contained in:
70
Assets/Game/Test/Scripts/AntManTestSceneBootstrap.cs
Normal file
70
Assets/Game/Test/Scripts/AntManTestSceneBootstrap.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AntManTestSceneBootstrap : MonoBehaviour
|
||||
{
|
||||
[Header("Escena")]
|
||||
[SerializeField] private string cubeName = "AntManCube";
|
||||
[SerializeField] private string lightName = "Directional Light";
|
||||
[SerializeField] private string cameraName = "Main Camera";
|
||||
|
||||
[ContextMenu("Build Test Scene")]
|
||||
public void BuildTestScene()
|
||||
{
|
||||
GameObject cube = FindOrCreateCube();
|
||||
FindOrCreateLight();
|
||||
FindOrCreateCamera(cube.transform.position);
|
||||
}
|
||||
|
||||
private GameObject FindOrCreateCube()
|
||||
{
|
||||
GameObject cube = GameObject.Find(cubeName);
|
||||
if (cube == null)
|
||||
{
|
||||
cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
cube.name = cubeName;
|
||||
cube.transform.position = Vector3.zero;
|
||||
}
|
||||
|
||||
if (cube.GetComponent<AntManScaleController>() == null)
|
||||
{
|
||||
cube.AddComponent<AntManScaleController>();
|
||||
}
|
||||
|
||||
if (cube.GetComponent<GhostTrailEmitter>() == null)
|
||||
{
|
||||
cube.AddComponent<GhostTrailEmitter>();
|
||||
}
|
||||
|
||||
return cube;
|
||||
}
|
||||
|
||||
private void FindOrCreateLight()
|
||||
{
|
||||
if (GameObject.Find(lightName) != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject lightObject = new GameObject(lightName);
|
||||
Light lightComponent = lightObject.AddComponent<Light>();
|
||||
lightComponent.type = LightType.Directional;
|
||||
lightComponent.intensity = 1.1f;
|
||||
|
||||
lightObject.transform.rotation = Quaternion.Euler(50f, -30f, 0f);
|
||||
}
|
||||
|
||||
private void FindOrCreateCamera(Vector3 targetPosition)
|
||||
{
|
||||
GameObject cameraObject = GameObject.Find(cameraName);
|
||||
if (cameraObject == null)
|
||||
{
|
||||
cameraObject = new GameObject(cameraName);
|
||||
cameraObject.tag = "MainCamera";
|
||||
cameraObject.AddComponent<Camera>();
|
||||
cameraObject.AddComponent<AudioListener>();
|
||||
}
|
||||
|
||||
cameraObject.transform.position = targetPosition + new Vector3(0f, 7f, -18f);
|
||||
cameraObject.transform.LookAt(targetPosition);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user