Ejemplo n.º 1
0
//	public bool _isOver = false;
    public Task boomTask()
    {
        TaskList tl = new TaskList();
//		tl.init = delegate {
//			_isOver = false;
//		};
//
        TaskWait tw = new TaskWait(0.1f);

        TaskManager.PushBack(tw, delegate {
            //_mesh.filter.gameObject.SetActive(false);
//			Debug.Log(_mesh);
//			Debug.Log(_mesh.vs);
            VoxelBoom.GetInstance().emission(_mesh, 15);
        });

        tl.push(tw);
//		tl.push (TaskWait.Create (0.1f, delegate {
//			_isOver = true;
//		}));
//		tl.isOver = delegate {
//			return _isOver;
//		};
        //TaskManager.Run (tl);
        return(tl);
    }
Ejemplo n.º 2
0
    private State getSkill()
    {
        StateWithEventMap swie = TaskState.Create(delegate() {
            TaskList tl = new TaskList();
            TaskWait tw = new TaskWait(0.01f);
            TaskManager.PushFront(tw, delegate() {
                this._animator.Play("skill");
            });
            Task task = new Task();

            task.isOver = delegate() {
                var info = _animator.GetCurrentAnimatorStateInfo(0);

                if (!info.IsName("skill"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };

            tl.push(tw);
            tl.push(task);
            tl.push(resetTask());
            return(tl);
        }, fsm_, delegate(FSMEvent evt) {
            return("idle");
        });

        return(swie);
    }
Ejemplo n.º 3
0
    private State getHit()
    {
        StateWithEventMap swie = TaskState.Create(delegate() {
            TaskList tl = new TaskList();
            TaskWait tw = new TaskWait(0.01f);
            TaskManager.PushFront(tw, delegate() {
                _animator.Play("def");
            });
            Task task = new Task();

            task.isOver = delegate() {
                var info = _animator.GetCurrentAnimatorStateInfo(0);
                if (info.normalizedTime > info.length)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };

            tl.push(tw);
            tl.push(task);
            tl.push(resetTask());
            return(tl);
        }, fsm_, delegate(FSMEvent evt) {
            return("idle");
        });

        return(swie);
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        TaskList taskList = new TaskList();
        //创建任务 当回调为true时进行下一个任务
        Task task1 = new Task();

        task1.init = delegate() {
            Debug.Log("this is first task!!!");
        };
        task1.IsOver = delegate() {
            //只有返回true才会执行下一任务
            return(true);
        };
        taskList.push(task1);

        //挂起两秒
        TaskWait wait = new TaskWait();

        wait.SetAllWaitTime(2f);
        taskList.push(wait);

        //创建第二个任务
        Task task2 = new Task();

        task2.init = delegate() {
            Debug.Log("this is second task!!!");
        };
        taskList.push(task2);


        TaskSet mt = new TaskSet();
        //创建第三个任务
        Task task3 = new Task();

        task3.init = delegate() {
            Debug.Log("this is third task!!!");
        };
        task3.IsOver = delegate()
        {
            Debug.Log("third task is finish");
            return(true);
        };
        mt.push(task3);

        //创建第四个任务
        Task task4 = new Task();

        task4.init = delegate() {
            Debug.Log("this is forth task!!!");
        };
        task4.IsOver = delegate()
        {
            Debug.Log("forth task is finish");
            return(true);
        };
        mt.push(task4);
        taskList.push(mt);

        TaskManager.Run(taskList);
    }
Ejemplo n.º 5
0
    public State getStart()
    {
        StateWithEventMap state = TaskState.Create(delegate() {
            Task task = new TaskWait(0.1f);
            TaskManager.PushFront(task, delegate {
                _hp = 5;
                _hpBar.setValue(_hp);
                _number++;
                if (_number % 2 == 1)
                {
                    _girl.SetActive(false);
                    _old.SetActive(true);
                }
                else
                {
                    _girl.SetActive(true);
                    _old.SetActive(false);
                }
            });
            //	_hpBar.setValue (_hp);
            return(task);
        }, this._fsm, "idle");


        return(state);
    }
Ejemplo n.º 6
0
        private Task pointTask()
        {
            float time = _time;
            //float flicker = 0.05f;
            // float all = 0f;
            TaskWait task = new TaskWait(time);

            TaskManager.PushFront(task, delegate
            {
                //  all = 0f;
                _point.SetActive(true);
            });

            TaskManager.PushBack(task, delegate
            {
                _point.SetActive(true);
            });

            /*
             * TaskManager.AddUpdate(task, delegate (float d)
             * {
             *  all += d;
             *  float fn = all / flicker;
             *  int n = Mathf.FloorToInt(fn);
             *  if ((n % 2) == 0)
             *  {
             *      _point.SetActive(true);
             *  }
             *  else {
             *      _point.SetActive(false);
             *  }
             * });*/
            return(task);
        }
Ejemplo n.º 7
0
    private void configureDependencies(DependencyGraph <IInitTask> dg)
    {
        //var loadGameConfig = new TaskLoadGameConfig();
        var waitTask = new TaskWait(3f);

        dg.AddItem(waitTask);
        //dg.AddItem(loadGameConfig).DependsOn(waitTask);
    }
Ejemplo n.º 8
0
    // Use this for initialization
    Task task(string name, int i)
    {
        Task task = new TaskWait(0.01f);

        task.init = delegate {
            Debug.Log(name + ":" + i);
        };
        return(task);
    }
Ejemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        TaskList tl    = new TaskList();
        Task     task1 = new Task();

        task1.init = delegate() {
            Debug.Log("this is firs task!!!");
        };
        task1.isOver = delegate() {
            return(true);
        };
        tl.push(task1);
        TaskWait wait = new TaskWait();

        wait.setAllTime(2f);
        tl.push(wait);
        Task task2 = new Task();

        task2.init = delegate() {
            Debug.Log("this is second task!!!");
        };
        tl.push(task2);

        TaskSet mt    = new TaskSet();
        Task    task3 = new Task();

        task3.init = delegate() {
            Debug.Log("this is third task!!!");
        };
        mt.push(task3);

        Task task4 = new Task();

        task4.init = delegate() {
            Debug.Log("this is four task!!!");
        };
        mt.push(task4);
        TaskWait wait2 = new TaskWait();

        wait2.setAllTime(5f);
        mt.push(wait2);

        Task task5 = new Task();

        task5.init = delegate() {
            Debug.Log("this is five task!!!");
        };
        mt.push(task5);

        tl.push(mt);


        TaskManager.Run(tl);
    }
Ejemplo n.º 10
0
 public IActionResult AddItem([FromBody] IdItemStack aItem)
 {
     try
     {
         BackpackManager.Request_Player_AddItem(aItem);
         TaskWait.Delay(5, () => BackpackManager.Request_Player_Info(new Id(aItem.id)).Wait());
         return(Ok());
     }
     catch (Exception Error)
     {
         return(NotFound(Error.Message));
     }
 }
Ejemplo n.º 11
0
        private StateBase logo()
        {
            State state = TaskState.Create(delegate {
                Task task = new TaskWait(1.0f);
                TaskManager.PushFront(task, delegate {
                    Root.Instance.view.anchor.hide();
                    Root.Instance.view.board.state = InfoBoard.State.Logo;
                });
                return(task);
            }, this.fsm_, "whoIsServer");

            return(state);
        }
Ejemplo n.º 12
0
        public void open()
        {
            // Debug.LogError("open!!!2");
            circle_ = new TaskCircle();
            Task tw = new TaskWait(_interval);

            TaskManager.PushBack(tw, delegate
            {
                this.heartbeat();
            });
            circle_.push(tw);
            TaskManager.Run(circle_);
        }
Ejemplo n.º 13
0
        public void open()
        {
            this.gameObject.SetActive(true);
            content_.gameObject.SetActive(true);
            InterfaceAnimManager iam = content_.GetComponent <InterfaceAnimManager>();
            TaskWait             tw  = new TaskWait(0.1f);

            TaskManager.PushBack(tw, delegate
            {
                iam.startAppear();
            });
            TaskManager.Run(tw);
        }
Ejemplo n.º 14
0
    /// <summary>
    /// 等待多少秒后执行任务
    /// </summary>
    /// <param name="time"></param>
    /// <param name="action"></param>
    public void TaskWait(float time, Action action)
    {
        TaskWait taskWait = new TaskWait();

        taskWait.SetAllWaitTime(time);
        TaskManager.PushBack(taskWait, delegate
        {
            if (action != null)
            {
                action();
            }
        });
        TaskManager.Run(taskWait);
    }
Ejemplo n.º 15
0
    private State getPlay()
    {
        State state = new State();

        state.addAction("game_over", "play2over");
        state.onStart += delegate() {
            Task task = new TaskWait(1);
            TaskManager.PushBack(task, delegate() {
                //fsm_.post("game_over");
            });
            TaskManager.Run(task);
        };
        return(state);
    }
Ejemplo n.º 16
0
        private State aloneState()
        {
            State state = TaskState.Create(delegate
            {
                Task task = new TaskWait(0.3f);
                TaskManager.PushFront(task, delegate {
                    Debug.Log("alone state task...");
                    // NetworkState.Instance?.doAlone();
                });
                return(task);
            }, this.fsm_, "single");

            return(state);
        }
Ejemplo n.º 17
0
    public State getHurt()
    {
        StateWithEventMap state = TaskState.Create(delegate() {
            Task task = new TaskWait(0.3f);
            TaskManager.PushFront(task, delegate() {
                _animator.Play("Hurt");
                Debug.Log("in attack");
            });

            return(task);
        }, this._fsm, "idle");


        return(state);
    }
Ejemplo n.º 18
0
    private State getAttack()
    {
        StateWithEventMap swie = TaskState.Create(delegate() {
            TaskList tl = new TaskList();
            TaskWait tw = new TaskWait(0.01f);
            TaskManager.PushFront(tw, delegate() {
                this._animator.Play("attack");
            });
            Task task = new Task();
            TaskManager.PushFront(task, delegate() {
            });
            task.isOver = delegate() {
                var info = _animator.GetCurrentAnimatorStateInfo(0);

                if (!info.IsName("attack"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };
            task.shutdown = delegate() {
                attack_--;
            };
            tl.push(tw);
            tl.push(task);
            tl.push(resetTask());
            return(tl);
        }, fsm_, delegate(FSMEvent evt) {
            if (this.attack_ != 0)
            {
                return("attack");
            }
            else
            {
                return("idle");
            }
        });

        swie.addAction("attack", delegate(FSMEvent evt) {
            attack_++;
            _animator.speed = 2 + (attack_ - 1) * 10;
        });

        return(swie);
    }
Ejemplo n.º 19
0
    public State getDie()
    {
        StateWithEventMap state = TaskState.Create(delegate() {
            Task task = new TaskWait(0.4f);
            TaskManager.PushFront(task, delegate() {
                VoxelBoom.GetInstance().emission(_mesh, 25);
                _old.SetActive(false);
                _girl.SetActive(false);
            });

            return(task);
        }, this._fsm, "start");


        return(state);
    }
Ejemplo n.º 20
0
        private State joinState()
        {
            State state = TaskState.Create(delegate {
                Task task = new TaskWait(0.3f);
                TaskManager.PushBack(task, delegate {
                    List <NetworkSystem.SessionInfo> sessions = NetworkState.Instance.sessions;
                    if (sessions.Count > 0 && NetworkState.Instance.isRunning)
                    {
                        //configure
                        NetworkState.Instance?.doJoin();
                    }
                });
                return(task);
            }, fsm_, "scanning");

            return(state);
        }
Ejemplo n.º 21
0
        private StateBase start()
        {
            State state = new State();

            state.onStart += delegate
            {
                TaskWait tw = new TaskWait(0.03f);
                TaskManager.PushBack(tw, delegate
                {
                    _status.play();
                    //
                });
                TaskManager.Run(tw);
            };
            state.addAction("play", "play");

            return(state);
        }
Ejemplo n.º 22
0
    public Task overTask()
    {
        TaskWait tw = new TaskWait();

        /*	tw.setAllTime (0.1f);
         *      //_body.AddForce
         *      TaskManager.PushFront (tw, delegate {
         *              _body.isKinematic = false;
         *              _body.useGravity = true;
         *                      });
         *      TaskManager.AddUpdate (tw, delegate(float d) {
         *              _body.AddForce(new Vector3(Random.Range(-50f, 50f), Random.Range(-50f, 50f),Random.Range(-10, -50f)));
         *                      });
         *      TaskManager.PushBack (tw, delegate {
         *              //_body.isKinematic = false;
         *              //_body.useGravity = true;
         *
         *                      });*/
        return(tw);
    }
Ejemplo n.º 23
0
    public Task overTask()
    {
        TaskSet tl = new TaskSet();

        for (int y = 0; y < _model.height; ++y)
        {
            for (int x = 0; x < _model.width; ++x)
            {
                Cube c = _model.getCube(x, y);
                if (c.isEnabled)
                {
                    Square s = _view.play.getSquare(x, y);
                    tl.push(s.overTask());
                }
            }
        }
        TaskWait tw = new TaskWait();

        tw.setAllTime(0.5f);
        tl.push(tw);
        return(tl);
    }
Ejemplo n.º 24
0
 private void PlayerConnected(Id ID)
 {
     UpdatePlayer(DB => DB.Players.Where(P => P.EntityId == ID.id), PlayerConnect);
     TaskWait.Delay(20, () => PlayerManager_Event_Player_Info(Request_Player_Info(ID).Result));
 }