void Awake() { AnimationInitialize(); logic = GetComponent <IChipLogic>(); chipType = logic.GetChipType(); Play("Awake"); StartCoroutine(ChipPhysics()); }
void OnEnable() { chip = (Chip)target; chip_id = serializedObject.FindProperty("id"); logic = chip.GetComponent <IChipLogic>(); if (logic != null) { chip.chipType = logic.GetChipType(); chip_type = serializedObject.FindProperty("chipType"); } IAnimateChip[] components = chip.GetComponents <IAnimateChip>(); List <Clip> clips = new List <Clip>(); foreach (IAnimateChip component in components) { clips.AddRange(component.GetClipNames().Select(x => new Clip(x)).ToList()); } foreach (Clip clip in clips) { if (!chip.clips_serialized.Contains(clip)) { chip.clips_serialized.Add(clip); } } foreach (Clip clip in new List <Clip>(chip.clips_serialized)) { if (!clips.Contains(clip) && chip.clips_serialized.Contains(clip)) { chip.clips_serialized.Remove(clip); } } chip.clips_serialized.Sort((Clip a, Clip b) => { return(string.CompareOrdinal(a.name, b.name)); }); }