void Awake() { rigid = GetComponent <Rigidbody2D>(); coll = GetComponent <BoxCollider2D>(); anim = GetComponent <AnimacionController>(); render = GetComponent <SpriteRenderer>(); fixedDelta = Time.fixedDeltaTime; }
void GetObjeto(GameObject obj) { objetoActual = obj; if (objetoActual == null) { controller = null; return; } if (controller != null && playing) { Stop(); } controller = objetoActual.GetComponent <AnimacionController>(); animacion = (controller != null) ? controller.animacion : null; }
void OnGUI() { if (Selection.activeGameObject != objetoActual) { GetObjeto(Selection.activeGameObject); } if (objetoActual == null) { EditorGUILayout.HelpBox("No has seleccionado ningún objeto", MessageType.Info); return; } if (controller == null) { controller = objetoActual.GetComponent <AnimacionController>(); if (controller == null) { EditorGUILayout.HelpBox("No contiene ningun script de animación", MessageType.Warning); return; } } if (animacion == null) { animacion = controller.animacion; if (animacion == null) { GetAnimacion(); return; } } if (animacion != controller.animacion) { animacion = controller.animacion; } MostrarGUI(); //SI HAY CAMBIOS -> GUARDAR EN 30s }