Exemplo n.º 1
0
    private void StartUnDo(float obj)
    {
        if (currentWayPoint >= 0 && Vector3.Distance(transform.position, path[currentWayPoint].position) > pathpointdistance)
        {
            transform.position    = Vector3.Lerp(transform.position, path[currentWayPoint].position, selfdamping);
            transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, path[currentWayPoint].eulerangel, selfdamping);
            if (ms != ModelStates.onair)
            {
                ms = ModelStates.onair;
            }
        }
        else
        {
            currentWayPoint--;
            if (currentWayPoint < 0)
            {
                currentWayPoint = 0;
                if (move_end != null)
                {
                    move_end(-1, selfinstallspeed);
                }
                state = stopmove;
                ms    = ModelStates.complete;
                UnSpark();

                RefreshSelfButton(false);
                return;
            }
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Restores a deleted model to what it was when it was deleted.
 /// </summary>
 public void Restore()
 {
     if (State == ModelStates.Deleted)
     {
         State = restoreState;
     }
 }
Exemplo n.º 3
0
 private void ReceiveAccept(byte[] buffer)
 {
     if (IsFlag(Flags.Accept, buffer))
     {
         State = ModelStates.Talk;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Called by a property when the status is changed
 /// </summary>
 public void PropertyChanged()
 {
     if (State == ModelStates.NoChange)
     {
         State = ModelStates.Updated;
     }
 }
Exemplo n.º 5
0
    void Awake()
    {
        //安装
        follow.OnEnter  = Spark;
        follow.OnUpdate = StartFollow; //跟随路径状态
        follow.OnLeave  = UnSpark;

        //拆解
        chase.OnEnter  = Spark;
        chase.OnUpdate = StartUnDo;         //追逐状态
        chase.OnLeave  = UnSpark;

        //闪光
        sparking.OnEnter  = Spark;
        sparking.OnLeave  = UnSpark;
        sparking.OnUpdate = StartSparking;

        //移动摄像机

        cameramoveing.OnEnter = delegate
        {
            CameraBess.GetInstance.ChoiseCamera(true, camepath, EndCameraMoveCall);
        };

        subMats        = new List <ShowMessage>();
        box            = GetComponent <BoxCollider>();
        selfmeshcolors = new Color[transform.childCount];
        ms             = ModelStates.none;
        rendermeshs    = GetComponentsInChildren <MeshRenderer> ();
    }
Exemplo n.º 6
0
    private void StartFollow(float obj)
    {
        if (currentWayPoint <= path.Length - 1 && Vector3.Distance(transform.position, path[currentWayPoint].position) > pathpointdistance)
        {
            transform.position    = Vector3.Lerp(transform.position, path[currentWayPoint].position, selfdamping);
            transform.eulerAngles = Vector3.Lerp(transform.eulerAngles, path[currentWayPoint].eulerangel, selfdamping);
            if (ms != ModelStates.onair)
            {
                ms = ModelStates.onair;
            }
        }
        else
        {
            //Debug.Log("正向执行到这里::::");
            currentWayPoint++;
            if (currentWayPoint >= path.Length)
            {
                currentWayPoint = path.Length - 1;

                ms = ModelStates.complete;
                UnSpark();
                if (move_end != null)
                {
                    move_end(1, selfinstallspeed);
                }
                state = stopmove;
                RefreshSelfButton(true);
            }
        }
    }
Exemplo n.º 7
0
        // Разговор
        private void BeginTalk()
        {
            State = ModelStates.Talk;

            callTimer.Start();

            audio.BeginSend();
            audio.BeginReceive();

            video.BeginReceive();
        }
Exemplo n.º 8
0
 /// <summary>
 /// Called by a child ctor for the initial setup of the model
 /// </summary>
 protected void SetupModel(bool isNew)
 {
     if (isNew)
     {
         State = ModelStates.New;
     }
     else
     {
         State = ModelStates.NoChange;
     }
 }
Exemplo n.º 9
0
        // Закрытие модели
        public void Closing()
        {
            if (State == ModelStates.Talk)
            {
                EndTalk();
            }
            State = ModelStates.Close;

            EndCall();
            bdtpClient.Dispose();
        }
Exemplo n.º 10
0
        private void WaitCall()
        {
            State = ModelStates.WaitCall;

            if (bdtpClient.Accept())
            {
                RemoteIP = bdtpClient.RemoteIP;

                State = ModelStates.IncomingCall;
            }

            EndWaitCall();
        }
Exemplo n.º 11
0
        // Исходящий вызов
        public void BeginCall()
        {
            State = ModelStates.OutgoingCall;
            EndWaitCall();

            // Подключение и ожидание ответа
            if (bdtpClient.Connect(remoteIP) && WaitAccept())
            {
                BeginTalk();
            }
            else
            {
                EndCall();
            }
        }
Exemplo n.º 12
0
 private void BindSoundToState(MediaPlayer media, ModelStates state)
 {
     if (media == null)
     {
         return;
     }
     try
     {
         if (model.State == state)
         {
             media.Dispatcher.Invoke(() => media.Play());
         }
         else
         {
             media.Dispatcher.Invoke(() => media.Stop());
         }
     }
     catch { }
 }
Exemplo n.º 13
0
 /// <summary>
 /// Method to handle changing the current state
 /// </summary>
 /// <param name="state">The state to set to</param>
 public void ModelStateChanged(ModelStates state)
 {
     switch (state)
        {
        case ModelStates.Login:
            SetLoginFormVisible();
            break;
        case ModelStates.Register:
            SetRegisterFormVisible();
            break;
        case ModelStates.Main:
            SetMainFormVisible();
            break;
        }
 }
Exemplo n.º 14
0
 /// <summary>
 /// Method to log the user out of their account
 /// </summary>
 public void Logout()
 {
     Model.User = null;
        ModelState = ModelStates.Login;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Method to log the user into their account
 /// </summary>
 /// <param name="username">The username provided by the user</param>
 /// <param name="password">The password provided by the user</param>
 public void Login(string username, string password)
 {
     try
        {
        Model.User = _userManager.Authenticate(username, password);
        ModelState = ModelStates.Main;
        Model.CredentialsList = _credentialsManager.GetCredentialsList(Model.User.Id);
        }
        catch (InvalidLoginException)
        {
        Model.InvalidLogin();
        }
 }
Exemplo n.º 16
0
 public ModelState<T> NewState(ModelStates newState)
 {
     return new ModelState<T>(Model, newState);
 }
Exemplo n.º 17
0
 public ModelState(T model, ModelStates state = ModelStates.None)
 {
     Model = model;
     State = state;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Sets the state to deleted and updates the restore state in case the delete needs to be undone.
 /// </summary>
 public void Delete()
 {
     restoreState = State;
     State        = ModelStates.Deleted;
 }