mirror of
https://github.com/Steffo99/octogem.git
synced 2024-11-22 13:04:19 +00:00
38 lines
876 B
C#
38 lines
876 B
C#
|
using UnityEngine;
|
|||
|
|
|||
|
public class GenericRenderer : MonoBehaviour
|
|||
|
{
|
|||
|
private RuntimeAnimatorController animatorController;
|
|||
|
private SpriteRenderer spriteRenderer;
|
|||
|
private Animator animator;
|
|||
|
|
|||
|
public RuntimeAnimatorController AnimatorController
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return animatorController;
|
|||
|
}
|
|||
|
|
|||
|
set
|
|||
|
{
|
|||
|
animatorController = value;
|
|||
|
animator.runtimeAnimatorController = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public virtual void Awake()
|
|||
|
{
|
|||
|
spriteRenderer = GetComponent<SpriteRenderer>();
|
|||
|
animator = GetComponent<Animator>();
|
|||
|
|
|||
|
if (spriteRenderer == null)
|
|||
|
{
|
|||
|
Debug.LogError("Missing spriteRenderer on rendered GameObject");
|
|||
|
}
|
|||
|
if (animator == null)
|
|||
|
{
|
|||
|
Debug.LogError("Missiong animator on rendered GameObject");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|