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; } } }
/// <summary> /// Restores a deleted model to what it was when it was deleted. /// </summary> public void Restore() { if (State == ModelStates.Deleted) { State = restoreState; } }
private void ReceiveAccept(byte[] buffer) { if (IsFlag(Flags.Accept, buffer)) { State = ModelStates.Talk; } }
/// <summary> /// Called by a property when the status is changed /// </summary> public void PropertyChanged() { if (State == ModelStates.NoChange) { State = ModelStates.Updated; } }
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> (); }
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); } } }
// Разговор private void BeginTalk() { State = ModelStates.Talk; callTimer.Start(); audio.BeginSend(); audio.BeginReceive(); video.BeginReceive(); }
/// <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; } }
// Закрытие модели public void Closing() { if (State == ModelStates.Talk) { EndTalk(); } State = ModelStates.Close; EndCall(); bdtpClient.Dispose(); }
private void WaitCall() { State = ModelStates.WaitCall; if (bdtpClient.Accept()) { RemoteIP = bdtpClient.RemoteIP; State = ModelStates.IncomingCall; } EndWaitCall(); }
// Исходящий вызов public void BeginCall() { State = ModelStates.OutgoingCall; EndWaitCall(); // Подключение и ожидание ответа if (bdtpClient.Connect(remoteIP) && WaitAccept()) { BeginTalk(); } else { EndCall(); } }
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 { } }
/// <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; } }
/// <summary> /// Method to log the user out of their account /// </summary> public void Logout() { Model.User = null; ModelState = ModelStates.Login; }
/// <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(); } }
public ModelState<T> NewState(ModelStates newState) { return new ModelState<T>(Model, newState); }
public ModelState(T model, ModelStates state = ModelStates.None) { Model = model; State = state; }
/// <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; }