示例#1
0
 public FSMData(T _state, VOID_FUN_VOID _cbIn, VOID_FUN_VOID _cbLoop, VOID_FUN_VOID _cbOut)
 {
     state  = _state;
     cbIn   = _cbIn;
     cbLoop = _cbLoop;
     cbOut  = _cbOut;
 }
示例#2
0
 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();
            }
        }
示例#4
0
        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();
            }
        }
示例#5
0
    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;
    }
示例#6
0
    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();
        }
    }
示例#7
0
 public FSMData(T _state, VOID_FUN_VOID _onIn, VOID_FUN_VOID _onModify, VOID_FUN_VOID _onOut)
 {
     state    = _state;
     onIn     = _onIn;
     onModify = _onModify;
     onOut    = _onOut;
 }
示例#8
0
 void OnMouseDown()
 {
     if (cb != null)
     {
         cb();
         cb = null;
     }
 }
 public void InvokeNo()
 {
     if (onClick != null)
     {
         onClick();
         onClick = null;
     }
     bodyGo.SetActive(false);
 }
示例#10
0
 void OnMouseDown()
 {
     if (onFinished != null)
     {
         onFinished();
         onFinished = null;
         gameObject.SetActive(false);
     }
 }
示例#11
0
 void OnMouseDown()
 {
     Debug.Log(3 + ":" + onFinished);
     //Application.LoadLevel("SomeLevel");
     if (onFinished != null)
     {
         onFinished();
         onFinished = null;
     }
 }
示例#12
0
    public static void SafeCall(ref VOID_FUN_VOID _on)
    {
        VOID_FUN_VOID _dummy = _on;

        _on = null;
        if (_dummy != null)
        {
            _dummy();
        }
    }
示例#13
0
 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();
            }
        }
示例#15
0
 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);
     }
 }
示例#16
0
        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();
            }
        }
示例#17
0
 public StateInfo(VOID_FUN_VOID _cbIn, VOID_FUN_VOID _cbModify, VOID_FUN_VOID _cbOut)
 {
     cbIn     = _cbIn;
     cbModify = _cbModify;
     cbOut    = _cbOut;
 }
示例#18
0
 public void InvokeT2(VOID_FUN_VOID _on)
 {
     Debug.Log(2 + ":" + _on);
     onFinished = _on;
     Debug.Log(2 + ":" + onFinished);
 }
示例#19
0
 public void RegisterEvent(VOID_FUN_VOID _on)
 {
     onItemChange += _on;
 }
示例#20
0
 public void SetCallback(VOID_FUN_VOID _cb)
 {
     gameObject.SetActive(true);
     cb = _cb;
 }
示例#21
0
 public void InvokeCall(VOID_FUN_VOID _on)
 {
     onFinished = _on;
 }
示例#22
0
 public void SetVisible(VOID_FUN_VOID _on)
 {
     Debug.Log(this + " SetVisible");
     bodyGo.SetActive(true);
     onClick = _on;
 }