public static void StopSwing(Transform trans) { SwingUpdate swing = trans.GetComponent <SwingUpdate>(); if (swing) { GameObject.DestroyImmediate(swing); } }
public static void Swing(float delay, Transform trans, float offsetAngle, float speed, float time, bool useDamping, Action endEvent, TweenEvent endEventWithParam) { SwingUpdate swing = trans.GetComponent <SwingUpdate>(); if (!swing) { swing = trans.gameObject.AddComponent <SwingUpdate>(); } swing.Swing(delay, offsetAngle, speed, time, useDamping, endEvent, endEventWithParam); }