示例#1
0
        public static void ObjectCreator(Vector3 position, Quaternion rotate, Vector3 scale, ObjectType object_type, ObjectColliderMaterial material = ObjectColliderMaterial.NONE, Action <GameObject> callback = null)
        {
            Debug.Log("ObjectCreator" + position.x);
            TaskSystem.getInstance().addTask(
                () =>
            {
                Debug.Log("task_system" + position.x);
                GameObject game_object           = ObjectPoolManager.getInstance().getPool(object_type.ToString()).getNewObject();
                game_object.transform.position   = position;
                game_object.transform.rotation   = rotate;
                game_object.transform.localScale = scale;

                game_object.SetActive(true);
                switch (material)
                {
                case ObjectColliderMaterial.NONE:
                    break;

                default:
                    break;
                }
                if (callback != null)
                {
                    callback(game_object);
                }
            });
        }
示例#2
0
    public override void start()
    {
        findWallGround();
        if (_groundNextToWall == null)
        {
            _taskEnded = true;
            return;
        }

        if (isNextToWall())
        {
            unit.changeState(new Drilling(_targetWall, 1));
        }
        else
        {
            if (Pathfinding.checkForPath(unit.transform.position, _groundNextToWall.transform.position))
            {
                unit.insertTask(TaskSystem.createWalkTask(_groundNextToWall.transform.position));
            }
            else
            {
                _taskEnded = true;
                return;
            }
        }
    }
示例#3
0
 public void Final()
 {
     for (int type = 0; type < this.typeCount; ++type)
     {
         if (this.objList[type] == null)
         {
             continue;
         }
         int count = this.objList[type].Length;
         for (int index = 0; index < count; ++index)
         {
             if (this.objList[type][index] == null)
             {
                 break;
             }
             this.objList[type][index].Release();
         }
         Object.Destroy(this.objParams[type].root);
     }
     this.category      = 0;
     this.typeCount     = 0;
     this.objList       = null;
     this.objParams     = null;
     this.activeObjTask = null;
 }
示例#4
0
        public void OnControlOn(Vector3 control_position)
        {
            if (is_capturing)
            {
                TaskSystem.getInstance().addTask(() =>
                {
                    LineRenderer renderer = parent_object.GetComponent <LineRenderer>();
                    renderer.enabled      = true;

                    // 線の幅
                    renderer.SetWidth(0.1f, 0.1f);
                    // 頂点の数
                    renderer.SetVertexCount(2);


                    // 頂点を設定
                    last_mouse_position    = control_position;
                    last_mouse_position.z -= Camera.main.transform.position.z;
                    //Vector3 line_start_pos = Camera.main.ScreenToWorldPoint(start_mouse_ppsition);
                    //Vector3 line_start_pos = Camera.main.ScreenToWorldPoint(start_mouse_ppsition);
                    Vector3 line_end_pos = Camera.main.ScreenToWorldPoint(last_mouse_position);
                    renderer.SetPosition(0, start_line_position);
                    renderer.SetPosition(1, line_end_pos);
                });
            }
        }
示例#5
0
 void Awake()
 {
     FatherDestroy = false;
     DS            = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem;
     TS            = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem;
     S             = GameObject.Find("Status").GetComponent("Status") as Status;
 }
示例#6
0
文件: END2.cs 项目: skanap/unity_game
 void Start()
 {
     DS = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem;
     TS = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem;
     S  = GameObject.Find("Status").GetComponent("Status") as Status;
     StartCoroutine(Wait1());
 }
示例#7
0
 /// <summary>
 /// 展示任务小面板
 /// </summary>
 /// <param name="taskSystem"></param>
 public void Show(TaskSystem taskSystem)
 {
     nameTxt.text = taskSystem.sy.currentTask.name;
     showUI.ShowNeeds(progress, taskSystem);
     //*****************************************测试
     //Debug.Log(taskSystem.sy.currentTask.tp.taskComplete["情报贩子"]);
 }
    private int enAwakeSplit = 0;                          // 接続されるリスト
    #endregion


    #region MAIN FUNCTION
    /// <summary>
    /// 初期化
    /// </summary>
    public void Initialize()
    {
        this.pool    = new TaskSystem <Collision>(POOL_MAX);
        this.players = new TaskSystem <Collision>(POOL_PL_MAX);
        this.enemies = new TaskSystem <Collision>(POOL_EN_MAX);

        this.plBullets = new TaskSystem <Collision> [COL_SPLIT];
        this.enBullets = new TaskSystem <Collision> [COL_SPLIT];
        for (int i = 0; i < COL_SPLIT; ++i)
        {
            this.plBullets[i] = new TaskSystem <Collision>(POOL_PBL_MAX);
            this.enBullets[i] = new TaskSystem <Collision>(POOL_EBL_MAX);
        }

        // 味方検査
        this.playerHandler = new OrderHandler <Collision>(this.PlayerOrder);
        // 敵検査
        this.enemyHandler = new OrderHandler <Collision>(this.EnemyOrder);
        // 接触判定
        this.scanHandler = new MatchHandler <Collision>(this.ScanOrder);
        // 接触処理
        this.hitHandler = new OrderHandler <Collision>(this.HitOrder);
        // 回収処理
        this.detachHandler = new OrderHandler <Collision>(this.DetachOrder);

        for (int i = 0; i < POOL_MAX; ++i)
        {
            this.collisions[i] = new Collision();
            this.pool.Attach(this.collisions[i]);
        }

#if DEBUG
        this.InitializeDebug();
#endif
    }
示例#9
0
    private float maxScreenWidth; // represents the max width of the camera for placing houses


    void Start()
    {
        task = new TaskSystem(this);
        hourTime = dayLengthSecs / dayLength;
        Application.runInBackground = true; //not part of game logic  if multiple of this change to only be called once 
        startTime = Time.time;
        dayCount = 0;
        //setTimeUI();
        first = true;

        if (!designateShelters)
        {
            //Start by making houses 
            GenerateShelters(numberShelters); // make shelter (haveing 5 to start with)  
        }
        else
        {
            SetShelters();
        }

        //Then make people
        GenerateVillagers();
        //Then the starting Resourses (the idea is its a exsisting village not a new one with nothing)


        foreach (Resource re in allResources)
        {
            re.numOf = Random.Range(re.startMin, re.startMax);
        }



    }
示例#10
0
 // Use this for initialization
 void Start()
 {
     DS = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem;
     S  = GameObject.Find("Status").GetComponent("Status") as Status;
     TS = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem;
     S.SendMessage("SetChapter", "After");
     Obj.SetActive(false);
     isFinOK = false;
     DS.Talking(15, 6, TS.GetFin());
 }
示例#11
0
 public override void start()
 {
     if (!isAtResource())
     {
         unit.insertTask(TaskSystem.createWalkTask(_resource.transform.position));
     }
     else
     {
         unit.changeState(new Pickup(_resource, unit));
     }
 }
示例#12
0
    private void Awake()
    {
        _inventory = new Inventory();
        _inventory.OnItemChanged += _inventory_OnItemChanged;
        InventoryUI.SetInventory(_inventory);

        _taskSystem = new TaskSystem();
        TaskSystemUI.SetTaskSystem(_taskSystem);

        _movementController = GetComponent <FPMovementController>();
    }
示例#13
0
 /// <summary>
 /// 展示任务面板所有信息
 /// </summary>
 /// <param name="sy"></param>
 /// <param name="taskSystem"></param>
 public void ShowPanel(TaskSystem taskSystem)
 {
     //Debug.Log(1);
     if (taskSystem.sy.currentTask.taskState == TaskState.Refresh)
     {
         //Debug.Log(2);
         taskSystem.GetCurrentTaskAll();
         taskSystem.SetTaskState(TaskState.PickUp);
     }
     //Debug.Log(3);
     SetUI(taskSystem);
 }
示例#14
0
 private void Start()
 {
     if (current == null)
     {
         current = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#15
0
    private void Start()
    {
        taskSystem = new TaskSystem <Task>();

        Worker worker = Worker.Create(character, new Vector3(0, 0));

        worker.gameObject.transform.GetChild(0).GetComponent <AStarTilemap>().tilemap       = tilemap;
        worker.gameObject.transform.GetChild(0).GetComponent <MoveTargetPosition>().tilemap = tilemap;
        WorkerTaskAI workerTaskAI = worker.gameObject.AddComponent <WorkerTaskAI>();

        workerTaskAI.Setup(worker, taskSystem);
    }
示例#16
0
    private void Start()
    {
        pathfinding = new Pathfinding();
        taskSystem  = new TaskSystem();

        terrainControl.generateWorld();

        foreach (Node n in terrainControl.getAllNodeObjects())
        {
            Pathfinding.addNode(n);
        }
    }
示例#17
0
 /// <summary>
 /// 接受任务按钮点击事件
 /// </summary>
 /// <param name="taskSystem"></param>
 /// <param name="bg"></param>
 public void PickUpTask(TaskSystem taskSystem, GameObject bg)
 {
     if (taskSystem.sy.currentTask.taskType != TaskType.Dialogue)
     {
         //TODO 执行遍历背包然后更改进度值的方法
         Debug.Log("待调试");
         EventCenter.Broadcast(EventDefine.FirstCheck);
     }
     taskSystem.SetTaskState(TaskState.Tasking);
     EventCenter.Broadcast(EventDefine.MiniTaskShowC);
     UIManager.GetInstance().CloseUIForms("MainTaskShow");
     SynopsisSystem.isFirst = true;
 }
示例#18
0
    // Use this for initialization
    void Start()
    {
        d = ds.GetComponent("DialogueSystem") as DialogueSystem;
        t = ts.GetComponent("TaskSystem") as TaskSystem;
        Task init = new Task();

        init.TaskID = 0;
        t.SetFin(init);
        d.Talking(1, 0, t.GetFin());
        _isfinOK = false;
        _isStart = false;
        //StartCoroutine(Wait());
    }
示例#19
0
 /// <summary>
 /// 设置button绑定事件
 /// </summary>
 /// <param name="taskSystem"></param>
 public void SetButton(TaskSystem taskSystem)
 {
     if (taskSystem.sy.currentTask.taskState == TaskState.PickUp)
     {
         button.onClick.RemoveAllListeners();
         button.onClick.AddListener(delegate() { buttonClick.PickUpTask(taskSystem, bg); });
     }
     else if (taskSystem.sy.currentTask.taskState == TaskState.UnSubmit)
     {
         Debug.Log("进入该方法");
         button.onClick.RemoveAllListeners();
         button.onClick.AddListener(delegate() { buttonClick.SubmitTask(taskSystem, bg); });
     }
 }
示例#20
0
 // Use this for initialization
 void Start()
 {
     EnableScoreMonitor = false;
     TaskSystem.getInstance().addTask(() =>
     {
         Initializer.getInstance().InitializeAll();
         ScoreModel.getInstance().StopTimer();
         ExecuteEvents.Execute <IRecieveStateChange>(gameObject, null,
                                                     (inter, rec) => { inter.OnChangeState(access.getState(AnimatedStateType.NORMAL)); }
                                                     );
         EnableScoreMonitor = true;
         ;
     });
 }
    public void Rising()
    {
        var context = new Contexts();

        context.game.services.MockService <IGameTimeService, MockGameTimeService>();

        var gameEventSystems = new GameEventSystems(context);
        var taskSystem       = new TaskSystem(context);

        var gameEntity = context.game.CreateEntity();

        var viewControllerObj = new GameObject("TestRisingViewController");

        viewControllerObj.AddComponent <CircleCollider2D>();

        var risingViewController = viewControllerObj.AddComponent <RiseViewController>();

        BindingTool.CheckBindings(risingViewController);

        var viewController = (IViewController)risingViewController;

        viewController.BeginController(context);
        viewController.OpenController(gameEntity);

        var rb = viewControllerObj.GetComponent <Rigidbody2D>();

        Assert.IsNotNull(rb);

        rb.rotation = UnityEngine.Random.Range(-3000, 3000);

        gameEntity.isRise = true;

        gameEventSystems.Execute();

        Assert.IsTrue(gameEntity.hasTask);

        int tryCount = 4000;

        while (gameEntity.hasTask &&
               --tryCount > 0)
        {
            taskSystem.Execute();

            gameEventSystems.Execute();
        }

        Assert.IsTrue(Math.Abs(rb.rotation) <= Mathf.Epsilon);
        Assert.IsFalse(gameEntity.hasTask);
    }
示例#22
0
    /// <summary>
    /// 完成任务按钮点击事件
    /// </summary>
    /// <param name="taskSystem"></param>
    /// <param name="bg"></param>
    public void SubmitTask(TaskSystem taskSystem, GameObject bg)
    {
        //Debug.Log("进行方法绑定");
        taskSystem.sy.SetTalkState(TalkState.Normal);
        //设置当前进入npc状态为普通状态
        taskSystem.sy.currentNpc.SetState(NpcState.Normal);
        if (taskSystem.sy.currentTask.taskType == TaskType.Dialogue)
        {
            taskSystem.sy.npcSystem.list[taskSystem.sy.currentTask.npcID - 1].SetState(NpcState.Normal);
            //拿到对话人的npc脚本
            for (int i = 0; i < taskSystem.sy.npcSystem.list.Count; i++)
            {
                //Debug.Log(npcSystem.list[i].npcName);
                //Debug.Log(currentTask.prop[0]);
                if (taskSystem.sy.npcSystem.list[i].npcName == taskSystem.sy.currentTask.prop[0])
                {
                    taskSystem.sy.npcSystem.list[i].SetState(NpcState.Normal);
                    break;
                }
            }
        }
        else
        {
            //不是对话任务移除采集的道具
            EventCenter.Broadcast(EventDefine.FinishTaskDelete);
        }
        //获取奖励的方法
        EventCenter.Broadcast(EventDefine.FinishTaskGet);
        //获取经验和金币
        Debug.Log("获取经验和金币待做");

        Debug.Log("待调试");

        UIManager.GetInstance().CloseUIForms("MainTaskShow");
        SynopsisSystem.isFirst = true;
        taskSystem.sy.SetTalkState(TalkState.Normal);
        //进行下一个任务的方法
        taskSystem.taskNum += 1;

        //点击变成任务刷新状态
        taskSystem.SetTaskState(TaskState.Refresh);

        //taskSystem.SetTaskState(TaskState.PickUp);
        EventCenter.Broadcast(EventDefine.ShowUI, taskSystem);
        EventCenter.Broadcast(EventDefine.MiniTaskShowC);
        Debug.Log("面板重置完成");
        //小面板显示的替换
    }
        public void VerifyUserTest()
        {
            var system   = new TaskSystem();
            var usrmgr   = new UserManager();
            var testUser = new User()
            {
                EMail        = "*****@*****.**",
                IsAdmin      = true,
                Name         = "TestUser",
                PasswordHash = system.CalculateMd5Hash("password")
            };

            testUser.Id = usrmgr.AddUser(testUser);
            Assert.IsTrue(system.VerifyUser(testUser.Name, "password"));
            usrmgr.RemoveUser(testUser);
        }
示例#24
0
 /// <summary>
 /// 构造方法
 /// </summary>
 public SynopsisSystem(InGameSystem _inGame) : base(_inGame)
 {
     _inGameSystem = _inGame;
     EventCenter.AddListener(EventDefine.ShowUIC, ShowUI);
     EventCenter.AddListener(EventDefine.ShowTalkTextC, ShowTalk);
     EventCenter.AddListener(EventDefine.ChangeNpcState, SetNpcState);
     EventCenter.AddListener(EventDefine.ShowTaskButtonC, ShowButton);
     EventCenter.AddListener(EventDefine.SetTaskPanelC, ShowTaskPanel);
     EventCenter.AddListener(EventDefine.MiniTaskShowC, ShowMiniTaskPanel);
     EventCenter.AddListener(EventDefine.Test, ShowProgress);
     taskSystem  = new TaskSystem(this);
     npcSystem   = new NpcSystem(this);
     talkSystem  = new TalkSystem(this);
     currentTask = new Task();
     //currentTask.taskState = TaskState.PickUp;
 }
示例#25
0
 // Use this for initialization
 void Start()
 {
     Scene1       = 0;
     Scene2       = 0;
     isLoad       = false;
     isReset      = false;
     Favorability = 0;
     IsTalking    = false;
     HaveTask     = false;
     isCountdown  = false;
     DS           = GameObject.Find("DialogueSystem").GetComponent("DialogueSystem") as DialogueSystem;
     TS           = GameObject.Find("TaskSystem").GetComponent("TaskSystem") as TaskSystem;
     drama        = GameObject.Find("Drama").GetComponent("Drama") as Drama;
     drama2       = GameObject.Find("Drama2").GetComponent("Drama2") as Drama2;
     Icon_Task    = GameObject.Find("Task");
     //Timer = GameObject.Find("Timer");
 }
示例#26
0
        // category オブジェクトのカテゴリ指定
        // prefabs  複製するPrefab リスト
        // caps     複製限界数リスト
        public void Initialize(int category, ScriptableObject[] scriptables, int[] caps)
        {
            // 初期化エラーチェック
            Debug.Assert(scriptables != null && scriptables.Length > 0);
            Debug.Assert(caps != null || caps.Length == scriptables.Length);
            this.category  = category;
            this.typeCount = scriptables.Length;
            this.objList   = new T[this.typeCount][];
            this.objParams = new ObjectParam[this.typeCount];


            // scriptable 読込
            int capacity = 0;

            for (int type = 0; type < this.typeCount; ++type)
            {
                int genMax = caps[type];
                if (genMax == 0)
                {
                    continue;
                }
                this.objList[type]             = new T[genMax];
                this.objParams[type].pool      = new T[genMax];
                this.objParams[type].freeIndex = -1;
                ScriptableObject scriptable = scriptables[type];

                // 開発用にまだPrefab が用意されていない場合を考慮してnull を許容する
                if (scriptables == null)
                {
                    continue;
                }

                this.objParams[type].genMax     = genMax;
                this.objParams[type].genCount   = 0;
                this.objParams[type].scriptable = scriptable;
                // 親ノード作成
                GameObject typeGo = new GameObject(scriptable.name);
                typeGo.isStatic = true;
                Transform typeRoot = typeGo.transform;
                this.objParams[type].root = typeRoot;
                // MEMO: シーン切替で自動で削除させない
                Object.DontDestroyOnLoad(typeGo);
                capacity += genMax;
            }
            this.activeObjTask = new TaskSystem <T>(capacity);
        }
示例#27
0
 /// <summary>
 /// 展示任务需求
 /// </summary>
 public void ShowNeeds(Text need, TaskSystem taskSystem)
 {
     //Debug.Log(taskSystem.GetHashCode());
     need.text = "";
     list.Clear();
     for (int i = 0; i < taskSystem.sy.currentTask.prop.Count; i++)
     {
         list.Add(taskSystem.sy.currentTask.prop[i] + ":");
     }
     //Debug.Log(taskSystem.sy.currentTask.tp.taskComplete["情报贩子"]);
     ShowProgress(taskSystem.sy.currentTask.tp.taskComplete, false);
     ShowProgress(taskSystem.sy.currentTask.td.taskNeed, true);
     for (int i = 0; i < list.Count; i++)
     {
         need.text += list[i] + "\n";
     }
 }
示例#28
0
        public CharactorInfoEmitter(CharactorControl emit_control)
        {
            m_CharacterControl = emit_control;
            emit_mutex         = new Mutex();
            start     = false;
            emit_wait = false;
            if (socket == null)
            {
                try
                {
                    GameObject go = GameObject.Find("SocketIO");
                    socket = go.GetComponent <SocketIOComponent>();
                }
                catch (Exception e)
                {
                    Debug.Log("Cannot found server interface program!" + e.Message);
                }
            }


            emit_thread = new Thread(new ThreadStart(() => {
                lock (emit_mutex)
                {
                    while (true)
                    {
                        while (!start)
                        {
                            Monitor.Wait(emit_mutex);
                        }

                        TaskSystem.getInstance().addTask(() =>
                        {
                            EmitData(m_CharacterControl.transform, m_CharacterControl.getJump(), m_CharacterControl.getMoveDirection(),
                                     m_CharacterControl.getClouch(), UnityEngine.Time.realtimeSinceStartup);
                        });
                        emit_wait = true;
                        while (emit_wait)
                        {
                            Monitor.Wait(emit_mutex);
                        }
                    }
                }
            }));
            emit_thread.Start();
        }
示例#29
0
 /// <summary>
 /// 任务面板的UI层信息显示
 /// </summary>
 /// <param name="taskSystem"></param>
 public void SetUI(TaskSystem taskSystem)
 {
     rewards.text = "";
     nameTxt.text = taskSystem.sy.currentTask.name;
     //Debug.Log(taskSystem.sy.currentTask.name);
     description.text = taskSystem.sy.currentTask.description;
     rewards.text    += "金钱: " + taskSystem.sy.currentTask.qr.coinCounts + "\n";
     rewards.text    += "经验: " + taskSystem.sy.currentTask.qr.experience + "\n";
     rewards.text    += "物品: ";
     foreach (var item in taskSystem.sy.currentTask.qr.Equip)
     {
         rewards.text += item.Key + " ";
     }
     //展示任务进度UI
     showUI.ShowNeeds(need, taskSystem);
     //为按钮添加点击事件
     SetButton(taskSystem);
 }
示例#30
0
 public override void start()
 {
     _digDamage = 1f;
     if (!isAtRubble())
     {
         if (Pathfinding.checkForPath(unit.transform.position, _rubble.transform.position))
         {
             unit.insertTask(TaskSystem.createWalkTask(_rubble.transform.position));
         }
         else
         {
             _taskEnded = true;
         }
     }
     else
     {
         unit.changeState(new Digging(_rubble, _digDamage));
     }
 }
示例#31
0
    private Collision ccol = null;                         // チェックするコリジョン
    #endregion


    #region MAIN FUNCTION
    /// <summary>
    /// 初期化
    /// </summary>
    public void Initialize()
    {
        this.pool    = new TaskSystem <Collision>(POOL_MAX);
        this.players = new TaskSystem <Collision>(POOL_PL_MAX);
        this.enemies = new TaskSystem <Collision>(POOL_EN_MAX);

        // 味方検査
        this.playerHandler = new OrderHandler <Collision>(this.PlayerOrder);
        // 接触判定
        this.scanHandler = new MatchHandler <Collision>(this.ScanOrder);
        // 接触処理
        this.hitHandler = new OrderHandler <Collision>(this.HitOrder);

        for (int i = 0; i < POOL_MAX; ++i)
        {
            this.collisions[i] = new Collision();
            this.pool.Attach(this.collisions[i]);
        }
    }