feat(materials): 更新材质贴图纹理和缩放参数
- 修改CoreBattleGround.mat材质的MainTex纹理GUID为4435756e5310e408fb125e8f4bcee9bd
- 调整CoreBattleGround.mat材质中EmissionMap和MainTex的缩放比例从{x: 1, y: 1}改为{x: 3, y: 3}
fix(models): 调整建筑模型全局缩放比例
- 将主要基地模型的globalScale从3调整为5
- 将水晶矿模型的globalScale从1调整为7,对应骨骼缩放从1调整为0.07
- 将机械出兵点模型的globalScale从1调整为7,对应骨骼缩放从1调整为0.07
feat(textures): 为模型添加纹理贴图
- 为水晶矿模型材质添加MainTex纹理,GUID为c24a978a0c9ad4dabb831e4b2bff0e2f
- 为机械出兵点模型材质添加MainTex纹理,GUID为fb52fc095c9554db895dde01ba8a8b6c
```
52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
[ExecuteAlways]
|
|
public class AdjustableGlowOrb : MonoBehaviour
|
|
{
|
|
[SerializeField] private Color glowColor = new Color(0.1f, 0.65f, 1f, 1f);
|
|
[SerializeField, Min(0f)] private float emissionIntensity = 2.5f;
|
|
[SerializeField] private Renderer targetRenderer;
|
|
|
|
private MaterialPropertyBlock propertyBlock;
|
|
|
|
private void OnEnable()
|
|
{
|
|
ApplyVisuals();
|
|
}
|
|
|
|
private void OnValidate()
|
|
{
|
|
ApplyVisuals();
|
|
}
|
|
|
|
public void SetGlowColor(Color color)
|
|
{
|
|
glowColor = color;
|
|
ApplyVisuals();
|
|
}
|
|
|
|
public Color GetGlowColor() => glowColor;
|
|
|
|
private void ApplyVisuals()
|
|
{
|
|
if (targetRenderer == null)
|
|
{
|
|
targetRenderer = GetComponent<Renderer>();
|
|
}
|
|
|
|
if (targetRenderer == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
propertyBlock ??= new MaterialPropertyBlock();
|
|
targetRenderer.GetPropertyBlock(propertyBlock);
|
|
|
|
Color emission = glowColor * emissionIntensity;
|
|
propertyBlock.SetColor("_BaseColor", glowColor);
|
|
propertyBlock.SetColor("_Color", glowColor);
|
|
propertyBlock.SetColor("_EmissionColor", emission);
|
|
targetRenderer.SetPropertyBlock(propertyBlock);
|
|
}
|
|
}
|