You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
using Spine.Unity;
|
|
using UnityEngine;
|
|
|
|
// UI등에서 사용되는 간단한 캐릭터 애니메이션(전투 등 불가).
|
|
public class IVCharSimple : MonoBehaviour
|
|
{
|
|
[SerializeField] protected SkeletonAnimation skAnim;
|
|
protected Spine.Skeleton skeleton;
|
|
protected MeshRenderer mrendAnim;
|
|
protected MaterialPropertyBlock mpbAnim;
|
|
|
|
public void Init()
|
|
{
|
|
skeleton = skAnim.Skeleton;
|
|
mrendAnim = skAnim.GetComponent<MeshRenderer>();
|
|
mpbAnim = new MaterialPropertyBlock();
|
|
mpbAnim.SetTexture(GlobalShaderProperty._mainTexPropertyID, mrendAnim.sharedMaterial.mainTexture);
|
|
}
|
|
|
|
#region Costume & Color
|
|
public void SetCostume(Texture2D tx2d)
|
|
{
|
|
if (tx2d == null)
|
|
return;
|
|
mpbAnim.SetTexture(GlobalShaderProperty._mainTexPropertyID, tx2d);
|
|
for (int i = 0; i < mrendAnim.sharedMaterials.Length; i++)
|
|
{
|
|
if (mrendAnim.sharedMaterials[i] == GameProperty.Instance.PlayerCharacterMaterial)
|
|
{
|
|
mrendAnim.SetPropertyBlock(mpbAnim, i);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetWeapon(Spine.Skin skincustom)
|
|
{
|
|
if (skincustom == null)
|
|
return;
|
|
skeleton.SetSkin(skincustom);
|
|
skeleton.SetSlotsToSetupPose();
|
|
skAnim.Update(0f);
|
|
}
|
|
|
|
public Spine.Skeleton GetSkeleton()
|
|
{
|
|
return skeleton;
|
|
}
|
|
#endregion Costume & color
|
|
|
|
}
|