/// <summary> /// Awake 시점에서 호출해야 한다. /// Start 에서 지정할 경우 gameobject가 다시 active 될 때까지 Start가 미뤄져서 최초 이벤트를 받지 못한다. /// </summary> /// <param name="target"></param> public void SetReaction(iStateReaction target) { UDL.Log(gameObject.name + " SetReaction. // " + gameObject.activeSelf, nLogOption, isDebug, nLogLevel); iReaction = target; }
private void Initialize() { if (bIsInitialze) { return; } bIsInitialze = true; if (hideFirstFrame) { transform.localScale = Vector3.zero; } UDL.Log(gameObject.name + " RegistEvent", nLogOption, isDebug, nLogLevel); if (iReaction == null) { iReaction = this; } State pState; for (int idx = 0; idx < arrSwitch.Length; idx++) { pState = FSM_Layer.Inst.GetState(arrSwitch[idx].layer, arrSwitch[idx].fsm, arrSwitch[idx].state); if (pState == null) { UDL.LogError(gameObject.name + " // " + arrSwitch[idx].state, nLogOption); return; } pState.EventStart_Before += OnStartBefore; pState.EventStart += OnStart; pState.EventStart_After1 += OnStartAfter1; pState.EventStart_After2 += OnStartAfter2; pState.EventEnd_Before += OnEndBefore; pState.EventEnd += OnEnd; pState.EventEnd_After += OnEndAfter; pState.EventPause += OnPause; pState.EventResume += OnResume; #if UNITY_EDITOR try { dicIndex.Add(arrSwitch[idx].state, arrSwitch[idx]); } catch { UDL.LogError(gameObject.name + " overlap state " + arrSwitch[idx].state, nLogOption); } #else dicIndex.Add(arrSwitch[idx].state, arrSwitch[idx]); #endif } Reaction_Expand p = GetComponent <Reaction_Expand>(); if (p) { p.Initialize(); } gameObject.SetActive(false); }