예제 #1
0
        public void Show()
        {
            Start();
            BeginPlay();
            if (BeginEvent != null)
            {
                BeginEvent.Invoke();
            }

            DogCall();
            PersonCall();
            WindCall();
            Funny();
            if (HighEvent != null)
            {
                HighEvent.Invoke();
            }

            EndPlay();
            GetCharge();
            if (EndEvent != null)
            {
                EndEvent.Invoke();
            }
        }
예제 #2
0
        public void Tick()
        {
            switch (CurrentData.direction)
            {
            case MoveDirection.x: from.position = from.position.XLerp(CurrentData.pos, speed); break;

            case MoveDirection.y: from.position = from.position.YLerp(CurrentData.pos, speed); break;

            case MoveDirection.z: from.position = from.position.ZLerp(CurrentData.pos, speed); break;
            }

            if (Distance() < Tolerance)
            {
                if (queue.Count == 0)
                {
                    AnilUpdate.Tasks.Remove(this);
                    EndEvent?.Invoke();
                    return;
                }
                CurrentData = queue.Dequeue();
                if (isPlus)
                {
                    CurrentData.Add(CurrentValue());
                }
            }
        }
예제 #3
0
    private IEnumerator EndLevel()
    {
        yield return(new WaitForSeconds(2.0f));

        _audioSource.pitch = 1.2f + Random.value * 0.2f;
        _audioSource.PlayOneShot(FanfareClip, 1.0f);

        yield return(new WaitForSeconds(3.0f));

        LightController light = Light.GetComponent <LightController>();

        light.SetEnabled(true);

        EndEvent?.Invoke(this, null);

        yield return(new WaitForSeconds(3.0f));

        Dart[] darts = FindObjectsOfType <Dart>();
        foreach (Dart dart in darts)
        {
            GameObject dartObject = dart.gameObject;
            // FIXME: Should be destroyed rather than deactivated.
            //GameObject.Destroy(dartObject);
            dartObject.SetActive(false);
        }

        GameObject.Destroy(_levelObject);

        yield return(new WaitForSeconds(0.5f));

        GoToNextLevel();
    }
예제 #4
0
 void Start()
 {
     if (ToCam == null)
     {
         ToCam = Camera.main;
     }
     onPress += (go, state) => {
         Open = state;
         if (state)
         {
             StartV2 = GetV2(Input.mousePosition);
             StartEvent.Invoke();
         }
         else
         {
             if (!Out)
             {
                 EndEvent.Invoke();
             }
             else
             {
                 Father.onPress(Father.gameObject, false);
             }
             Out = false;
         }
     };
 }
예제 #5
0
        /// <summary>
        /// Used to handle model property updates
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateProperty(object sender, PropertyChangedEventArgs e)
        {
            PropertyChanged?.Invoke(this, e);

            // If the user reaches the end, end the game
            if (e.PropertyName == "LocalPosition" && LocalPosition == EndPos)
            {
                Model.ServerUpdateEvent -= HandleServerMessage;
                Application.Current.Dispatcher.Invoke(() =>
                {
                    EndEvent?.Invoke(true);
                });
                Model.Close();
            }
            // If the enemy reaches the end, end the game
            else if (e.PropertyName == "EnemyPosition" && EnemyPosition == EndPos)
            {
                Model.ServerUpdateEvent -= HandleServerMessage;
                Application.Current.Dispatcher.Invoke(() =>
                {
                    EndEvent?.Invoke(false);
                });
                Model.Close();
            }
            // If the maze is update; enable the user inputs
            else if (e.PropertyName == "Maze")
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    MazeLoaded?.Invoke();
                });
            }
        }
 public StartTurnOffPageDialogLogic(IPageDialogPresenter presenter)
 {
     this.presenter             = presenter;
     avm                        = new AuthorizationViewModel();
     avm.AuthorizationEndEvent += (user) =>
     {
         Statics.CurrentUser.Instance.User = user;
         EndEvent?.Invoke(PageDialogResult.Completed);
     };
     avm.RegistrationRequiredEvent += () =>
     {
         if (rvm == null)
         {
             rvm              = new RegistrationViewModel();
             rvm.CancelEvent += () =>
             {
                 presenter.ShowPage(avm);
             };
             rvm.RegistrationCompleteEvent += () =>
             {
                 presenter.ShowPage(avm);
             };
         }
         presenter.ShowPage(rvm);
     };
 }
예제 #7
0
        /// <summary>
        /// 结束整个流程
        /// </summary>
        public void End()
        {
            _currentContent = null;
            _currentTarget  = null;
            _running        = false;
            _executing      = false;

            EndEvent?.Invoke();
        }
        public void StartDialog()
        {
            EditTaskViewModel etvm = new EditTaskViewModel(currentTask);

            etvm.EditResult += (res) =>
            {
                EndEvent?.Invoke(res);
            };
            presenter.ShowPage(etvm);
        }
예제 #9
0
        /// <summary>
        /// 结束任务流程
        /// </summary>
        public void End()
        {
            _currentStepIndex = 0;
            _currentContent   = null;
            _currentTarget    = null;
            _currentHelper    = null;
            _running          = false;
            _pause            = false;
            _executing        = false;

            EndEvent?.Invoke();
        }
예제 #10
0
 private void GoToNextLevel()
 {
     ++LevelIndex;
     if (LevelIndex >= LevelPrefabs.Length)
     {
         LevelIndex = 0;
     }
     if (LevelIndex == 0)
     {
         TotalScore = 0;
         EndEvent?.Invoke(this, null);
     }
     LoadLevel(LevelIndex);
 }
예제 #11
0
        public void StartDialog()
        {
            SelectUserViewModel suvm = new SelectUserViewModel();

            suvm.UserResult += (result) =>
            {
                if (result)
                {
                    var user = suvm.SelectedUser;
                    if (currentTask.Performers.FirstOrDefault(p => p.User.ID == user.ID) != null)
                    {
                        MessageBox.Show("Пользователь " + user.FIO + " уже есть в списке исполнителей.");
                        presenter.ShowPage(suvm);
                    }
                    else
                    {
                        ResolutionAndDateViewModel rdvm = new ResolutionAndDateViewModel();
                        rdvm.PerfomerResult += (res) =>
                        {
                            if (res == PageDialogResult.Canceled)
                            {
                                EndEvent?.Invoke(res);
                            }
                            else
                            {
                                currentTask.Performers.Add(new Performer()
                                {
                                    User              = user,
                                    Message           = rdvm.Message,
                                    PeriodOfExecution = rdvm.Period,
                                    WorkTask          = currentTask
                                });
                                if (DB.TaskDataBase.Instance.SafeSaveChanges())
                                {
                                    EndEvent?.Invoke(res);
                                }
                            }
                        };
                        presenter.ShowPage(rdvm);
                    }
                }
                else
                {
                    EndEvent?.Invoke(PageDialogResult.Canceled);
                }
            };
            presenter.ShowPage(suvm);
        }
        public void StartDialog()
        {
            NewTaskViewModel ntwm = new NewTaskViewModel();

            ntwm.CreateResult += (res) =>
            {
                if (res == PageDialogResult.Canceled)
                {
                    EndEvent?.Invoke(res);
                }
                else
                {
                    newTask = ntwm.NewTask;
                    ResolutionAndDateViewModel rdvm = new ResolutionAndDateViewModel();
                    rdvm.PerfomerResult += (result) =>
                    {
                        if (result == PageDialogResult.Canceled)
                        {
                            EndEvent?.Invoke(result);
                        }
                        else
                        {
                            newTask.Performers = new List <Performer>();
                            newTask.Performers.Add(new Performer()
                            {
                                User              = CurrentUser.Instance.User,
                                Message           = rdvm.Message,
                                PeriodOfExecution = rdvm.Period,
                                WorkTask          = newTask
                            });
                            DB.TaskDataBase.Instance.WorkTasks.Add(newTask);
                            if (DB.TaskDataBase.Instance.SafeSaveChanges())
                            {
                                EndEvent?.Invoke(result);
                            }
                        }
                    };
                    presenter.ShowPage(rdvm);
                }
            };
            presenter.ShowPage(ntwm);
        }
예제 #13
0
        /// <summary>
        /// 结束任务流程
        /// </summary>
        public void End()
        {
            _currentStepIndex = 0;
            _currentContent   = null;
            _currentTarget    = null;
            _currentHelper    = null;
            _running          = false;
            _pause            = false;
            _executing        = false;

            StopSkip();

            if (_waitCoroutine != null)
            {
                Main.Current.StopCoroutine(_waitCoroutine);
                _waitCoroutine = null;
            }

            EndEvent?.Invoke();
        }
예제 #14
0
        /// <summary>
        /// Pass on the property change notifications from the model
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ModelUpdate(object sender, PropertyChangedEventArgs e)
        {
            PropertyChanged?.Invoke(this, e);

            // If the player reaches the end of the maze, we display a message and close
            if (PlayerPosition == EndPos)
            {
                if (!ended)
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        EndEvent?.Invoke();
                    });
                    Model.PropertyChanged -= ModelUpdate;
                    ended = true;
                }
            }
            // If the server loaded a solution, we begin the animation
            if (e.PropertyName == "Solution")
            {
                SolutionUpdate();
            }
        }
예제 #15
0
 protected virtual void OnEndEvent(IOthello othello, int result)
 {
     EndEvent?.Invoke(othello, result);
 }
 private void End() => EndEvent?.Invoke();
예제 #17
0
 private void OnDestroy()
 {
     EndEvent?.Invoke();
     systems.ForEach(system => system.Destroy());
 }
예제 #18
0
    //===============================================================================================
    // Fixed update method
    //-----------------------------------------------------------------------------------------------
    // set velocity & direction, and calculate distance
    // 속도와 방향 설정 후 거리 계산
    //===============================================================================================
    void FixedUpdate()
    {
        //===========================================================================================
        //  If it is not moving, stop object and return
        //  움직이지 않는다면, 물체를 멈추고 종료
        //===========================================================================================
        if (!isMove)
        {
            targetRigidbody.velocity = new Vector3(0, 0, 0);        // Stop
            return;
        }

        //===========================================================================================
        // Function to make objects look at the next path
        // 물체가 다음 Path를 바라보게하는 기능
        //===========================================================================================
        Vector3 offset = nextPath.transform.position - target.transform.position;

        offset.Normalize();
        Quaternion q = Quaternion.LookRotation(offset);

        targetRigidbody.rotation =
            Quaternion.Slerp(targetRigidbody.rotation,
                             q, turningSpeed * Time.deltaTime);

        //===========================================================================================
        // Function to make objects follow a path
        // 물체가 path를 따라가게 하는 기능
        //===========================================================================================
        offset.Normalize();
        targetRigidbody.velocity = offset * speed * Time.deltaTime;

        // calculate distance between object and next path
        // 물체와 next path 경로 사이의 거리 계산
        float Distance = Vector3.Distance(nextPath.transform.position,
                                          target.transform.position);

        //===========================================================================================
        // If it is close enough to the next path
        // next path에 충분히 가까워졌을 경우
        //===========================================================================================
        if (Distance < distanceThreshold)
        {
            if (pathIndex < path.PathList.Count)
            {
                //=======================================================================================
                // If the end of the path list is not reached, set the next path by increase path Index
                // path 리스트의 끝에 도달하지 못했다면, path Index ++ 를 통해 next path 설정
                //=======================================================================================
                nextPath = path.PathList[pathIndex++];
            }
            else
            {
                //===================================================================================
                // If the object reached end of the path list,
                // path 리스트 끝에 도달했다면, 즉, 최종 목적지에 도달했을때
                //===================================================================================
                if (path.isClosed)
                {
                    //===============================================================================
                    // If current path is closed path, back to zero of the path list
                    // 현재 path가 닫힌 경로이면, 다시 pathList[0]을 향해 전진
                    //===============================================================================
                    nextPath  = path.PathList[0];
                    pathIndex = 0;
                }
                else
                {
                    //===============================================================================
                    // If current path is open path,
                    // 현재 path가 열린 경로이면,
                    //===============================================================================
                    if (isLoop)
                    {
                        //===========================================================================
                        // and object move repeatedly reinit position & value;
                        // 그리고 물체가 반복적으로 움직인다면, position과 변수 다시 초기화
                        //===========================================================================
                        nextPath  = path.PathList[1];
                        pathIndex = 1;
                        this.transform.position = path.PathList[0].transform.position;
                        target.transform.LookAt(path.PathList[1].transform);
                        // If endEvent isn't null, run method.
                        // endEvent가 null이 아니면, method를 실행
                        if (endEvent != null)
                        {
                            endEvent.Invoke();
                        }
                    }
                    else
                    {
                        //==========================================================================
                        // If object move once, Stop move and if endEvent isn't null, run method.
                        // 물체가 한번만 움직이면 멈추고, endEvent!=null이 아니면, method를 실행
                        //==========================================================================
                        StopFollow();
                        if (endEvent != null)
                        {
                            endEvent.Invoke();
                        }
                    }
                }
            }
        }
    }
예제 #19
0
 protected override void OnDisappearing()
 {
     GetStatuses();
     EndEvent.Invoke(filter);
     base.OnDisappearing();
 }
예제 #20
0
 public void OnEnd(object sender, string message) => EndEvent?.Invoke(sender, message);
예제 #21
0
 public void End()
 {
     EndEvent?.Invoke();
 }
예제 #22
0
 public void Start()
 {
     GetFilesInfo();
     Rename();
     EndEvent?.Invoke();
 }
 private void OnDestroy()
 {
     systems.Foreach(item => item.Stop());
     systems.Foreach(system => system.Unsubscribe());
     EndEvent?.Invoke();
 }
 private void AriClientOnStasisEndEvent(IAriClient sender, StasisEndEvent e)
 {
     EndEvent?.Invoke(this, e);
 }
예제 #25
0
 protected void OnEndEvent(EventsThreads.ThreadEndEventArgs e)
 {
     EndEvent?.Invoke(this, e);
 }