public FSMData(T _state, VOID_FUN_VOID _cbIn, VOID_FUN_VOID _cbLoop, VOID_FUN_VOID _cbOut) { state = _state; cbIn = _cbIn; cbLoop = _cbLoop; cbOut = _cbOut; }
public void AddState(T _t, VOID_FUN_VOID _cbIn, VOID_FUN_VOID _cbLoop, VOID_FUN_VOID _cbOut) { if (!dicState.ContainsKey(_t)) { dicState.Add(_t, new FSMData <T>(_t, _cbIn, _cbLoop, _cbOut)); } }
void Start() { //추가하기... onXXX += Fun1; onXXX += Fun2; onXXX += Fun3; if (onXXX != null) { Debug.Log("====[1. first add3 ]====="); onXXX(); } //기존에 더 추가하기... onXXX += Fun1; if (onXXX != null) { Debug.Log("====[2. add 1 ]====="); onXXX(); } //있던 없던 빼기... onXXX -= Fun1; if (onXXX != null) { Debug.Log("====[3. remove 1 ]====="); onXXX(); } }
public void MoveState(T _nextState) { if (!dicState.ContainsKey(_nextState)) { Debug.LogError("Not found State:" + _nextState); return; } if (cbOut != null) { cbOut(); } preState = curState; curState = _nextState; nextState = _nextState; FSMData <T> _data = dicState[_nextState]; cbIn = _data.cbIn; cbLoop = _data.cbLoop; cbOut = _data.cbOut; if (cbIn != null) { cbIn(); } }
void Update() { transform.Rotate(Vector3.up * speedTurn * Time.deltaTime); if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetMouseButtonDown(0)) { if (callback != null) { callback(); callback = null; } count = 0; } else if (Input.GetKey(KeyCode.Space) || bAuto) { Bullet _bullet = Instantiate(bulletPrefab, spawn.position, spawn.rotation) as Bullet; //_bullet.transform.SetParent (spawn); callback += _bullet.OnDestroy; _bullet.boss = this; _bullet.name += count++; } lvCount.text = "" + count; }
protected void ChangeState(T _state) { if (!dicState.ContainsKey(_state)) { Debug.LogError(" Not Found State Change and Check state"); return; } //before state information is clear; if (onOut != null) { onOut(); } //change state befState = curState; curState = _state; nextState = _state; FSMData <T> _data = dicState[curState]; onIn = _data.onIn; onModify = _data.onModify; onOut = _data.onOut; //init data if (onIn != null) { onIn(); } }
public FSMData(T _state, VOID_FUN_VOID _onIn, VOID_FUN_VOID _onModify, VOID_FUN_VOID _onOut) { state = _state; onIn = _onIn; onModify = _onModify; onOut = _onOut; }
void OnMouseDown() { if (cb != null) { cb(); cb = null; } }
public void InvokeNo() { if (onClick != null) { onClick(); onClick = null; } bodyGo.SetActive(false); }
void OnMouseDown() { if (onFinished != null) { onFinished(); onFinished = null; gameObject.SetActive(false); } }
void OnMouseDown() { Debug.Log(3 + ":" + onFinished); //Application.LoadLevel("SomeLevel"); if (onFinished != null) { onFinished(); onFinished = null; } }
public static void SafeCall(ref VOID_FUN_VOID _on) { VOID_FUN_VOID _dummy = _on; _on = null; if (_dummy != null) { _dummy(); } }
public void AddState(T _t, VOID_FUN_VOID _pIn, VOID_FUN_VOID _pIng, VOID_FUN_VOID _pOut) { //Debug.Log (_t); if (!dicState.ContainsKey(_t)) { StateInfo _s = new StateInfo(_pIn, _pIng, _pOut); dicState.Add(_t, _s); } else { Debug.LogError(" 동일한 상태 등록" + _t); } }
void Start() { //추가하기... onXXX += Fun1; onXXX += Fun2; onXXX += Fun3; if (onXXX != null) { Debug.Log("====[1. first add3 ]====="); onXXX(); } }
protected void AddState(T _state, VOID_FUN_VOID _onIn, VOID_FUN_VOID _onModify, VOID_FUN_VOID _onOut) { if (!dicState.ContainsKey(_state)) { //add //Debug.Log(_onIn + ":" + _onModify + ":" + _onOut); FSMData <T> _data = new FSMData <T>(_state, _onIn, _onModify, _onOut); dicState.Add(_state, _data); } else { Debug.LogError("Same State Add Error" + _state); } }
public void MoveState(T _nextState) { //Debug.Log (_t); if (_nextState.Equals(currentState)) { return; } else if (!dicState.ContainsKey(_nextState)) { Debug.LogError("등록되지 않는 상태 입니다." + _nextState); return; } //state out is callback pInOut... if (cbOut != null) { cbOut(); } //state beforeState = currentState; currentState = _nextState; //nextState = _nextState; //callback setting. StateInfo _s = dicState [_nextState]; cbIn = _s.cbIn; cbModify = _s.cbModify; cbOut = _s.cbOut; if (cbIn != null) { cbIn(); } }
public StateInfo(VOID_FUN_VOID _cbIn, VOID_FUN_VOID _cbModify, VOID_FUN_VOID _cbOut) { cbIn = _cbIn; cbModify = _cbModify; cbOut = _cbOut; }
public void InvokeT2(VOID_FUN_VOID _on) { Debug.Log(2 + ":" + _on); onFinished = _on; Debug.Log(2 + ":" + onFinished); }
public void RegisterEvent(VOID_FUN_VOID _on) { onItemChange += _on; }
public void SetCallback(VOID_FUN_VOID _cb) { gameObject.SetActive(true); cb = _cb; }
public void InvokeCall(VOID_FUN_VOID _on) { onFinished = _on; }
public void SetVisible(VOID_FUN_VOID _on) { Debug.Log(this + " SetVisible"); bodyGo.SetActive(true); onClick = _on; }