public void Vegrehajt(Execute parancs, IsDone fixedUpdateFeltetel = null) { lock(this) { execute = parancs; isDone = fixedUpdateFeltetel; } _waitHandle.WaitOne(); }
public bool Felszed(bool changeTag = false) { lock (this) { float targetY = 0.0f; lifting = null; execute = delegate { Ray ray = new Ray(transform.position, -1 * transform.up); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { //Debug.Log("Hit something", hit.rigidbody); if (hit.rigidbody) { lifting = hit.rigidbody; targetY = this.transform.position.y - 0.8f; lifting.transform.parent = this.transform; if (changeTag) { lifting.gameObject.tag = tag; } } } }; isDone = delegate { if (lifting == null) return true; if (lifting.position.y > targetY || lifting.velocity.magnitude < 0.01f) { lifting.isKinematic = true; lifting.velocity = Vector3.zero; lifting.angularVelocity = Vector3.zero; lifting.transform.position = transform.position + new Vector3(0, -0.8f, 0); lifting.transform.rotation = Quaternion.identity; return true; } else { lifting.AddForce(0, 50, 0, ForceMode.Acceleration); return false; } }; } _waitHandle.WaitOne(); return lifting != null; }
public void Menj(float x, float y, float z) { lock(this) { execute = delegate { SetTarget(x, y, z); }; isDone = delegate { return IsClose(); }; } _waitHandle.WaitOne(); }
void FixedUpdate () { Vector3 g = new Vector3(0, 9.81f, 0); Vector3 p = target - rb.transform.position; Vector3 v = -1*rb.velocity; Vector3 f = g+Vector3.Scale(Kv, v) +Vector3.Scale(Kp, p); f = Vector3.Min(f, maximalisToloEro); f = Vector3.Max(f, -maximalisToloEro); rb.AddForce(engineOn*f, ForceMode.Force); Debug.DrawLine(transform.position, target, Color.red); lock(this) { if (execute != null) { execute(); execute = null; if (isDone == null) _waitHandle.Set(); } if (isDone != null) { if (isDone()) { isDone = null; _waitHandle.Set(); } } } if (engine != null) { ParticleSystem.EmissionModule emission = engine.emission; emission.enabled = engineOn > 0; engine.transform.rotation = Quaternion.LookRotation(-f); engine.startSize = f.magnitude / 9.81f; } }
public void Elmozdul(float deltaX, float deltaY, float deltaZ) { lock (this) { execute = delegate { SetTarget(target.x+ deltaX, target.y+ deltaY, target.z+ deltaZ); }; isDone = delegate { return IsClose(); }; } _waitHandle.WaitOne(); }
public void Menj(GameObject o, float deltaX, float deltaY, float deltaZ) { lock (this) { execute = delegate { SetTarget(o.transform.position.x + deltaX, o.transform.position.y + deltaY, o.transform.position.z + deltaZ); }; isDone = delegate { return IsClose(); }; } _waitHandle.WaitOne(); }
public void Elore(float tavolsag) { lock (this) { execute = delegate { Vector3 dir = transform.forward.normalized; Vector3 t = target + tavolsag * dir; SetTarget(t.x, t.y, t.z); }; isDone = delegate { return IsClose(); }; } _waitHandle.WaitOne(); }
private void OnWindowClosedAction() { _eventAggregator.GetEvent <EditSettingsFinishedEvent>().Unsubscribe(OnWindowClosedAction); _eventAggregator.GetEvent <MainWindowClosedEvent>().Unsubscribe(OnWindowClosedAction); IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success)); }
private void ResolveInteractionResult(ValidateContinueWithSavingInteraction interactionResult) { var responseStatus = interactionResult.Response == MessageResponse.Yes ? ResponseStatus.Success : ResponseStatus.Cancel; IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(responseStatus)); }
private void IsDoneWithErrorCallback(MessageInteraction interaction) { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Error)); }
protected void RaiseIsDone(ResponseStatus responseStatus) { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(responseStatus)); }