private void updateTipText(TipState state) { if (currentState != state) { currentState = state; switch (state) { case TipState.None: infoLabel.Text = "Look here for tips and tricks!"; break; case TipState.FocusAreas: infoLabel.Text = "Try to only choose a few focus areas at a time in order to focus the search more efficiently."; break; case TipState.TargetBehavior: infoLabel.Text = "Choose how the target should move. Simple movement are easier for the robots to learn to target, while moving targets are more realistic."; break; case TipState.TrainButton: infoLabel.Text = "When all parameters are satisfactory set, start the training with this button."; break; case TipState.ResetButton: infoLabel.Text = "Set all parameter values to 0."; break; } } }
private void timer_Tick(object sender, EventArgs e) { timer.Stop(); switch (state) { case TipState.Initial: if (active_control == null) { return; } tooltip_window.Present(active_control, (string)tooltip_strings[active_control]); state = TipState.Show; timer.Interval = autopop_delay; timer.Start(); break; case TipState.Show: tooltip_window.Visible = false; state = TipState.Down; break; default: throw new Exception("Timer shouldn't be running in state: " + state); } }
public void Attack(Transform targ, float speed) { _kinematicSpeed = speed; State = TipState.Attacking; Target = targ; _hitTarget = false; }
private void PhysicsFinishRetracting() { if (State == TipState.Retracting && (transform.position - _baseTransform.position).magnitude <= _locationEpsilon) { //Debug.Log("Retraction complete"); gameObject.GetComponent <Rigidbody2D>().velocity = Vector2.zero; gameObject.GetComponent <Rigidbody2D>().isKinematic = true; State = TipState.Idle; } else { Vector2 dir2Target = _baseTransform.position - transform.position; dir2Target.Normalize(); GetComponent <Rigidbody2D>().AddForce(dir2Target * 10, ForceMode2D.Impulse); //Debug.Log("retracting force: " + dir2Target * 10); } }
private void PhysicsRetract() { //Debug.Log("PhysicsRetract"); if (GetComponent <Rigidbody2D>().isKinematic) { GetComponent <Rigidbody2D>().isKinematic = false; } gameObject.GetComponent <Rigidbody2D>().velocity = Vector2.zero; Vector2 dir2Base = _baseTransform.position - transform.position; dir2Base.Normalize(); dir2Base *= 100; //Debug.Log("Rectract Apply: " + dir2Base); gameObject.GetComponent <Rigidbody2D>().AddForce(dir2Base); State = TipState.Retracting; }
/// <param name="collision"></param> private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Wall") { moving = true; tipState = TipState.Wall; } if (collision.tag == "Button") { moving = true; tipState = TipState.Button; } if (collision.tag == "Item") { tipState = TipState.Item; moving = true; } }
// Update is called once per frame void Update() { if (lastMousePosition != Input.mousePosition && Delay > 0) { timer = 0.0f; lastMousePosition = Input.mousePosition; LastObject = null; Hide(); return; } else { if (timer <= Delay) { timer += Time.deltaTime; return; } } TipState newState = TipState.None; if (LastObjectUI != null) { newState = (TipState)Mathf.Max((int)newState, (int)GetTargetUI()); } else { foreach (Camera cam in cameras) { newState = (TipState)Mathf.Max((int)newState, (int)GetTargetCamera(cam)); } } switch (newState) { case TipState.None: Hide(); LastObject = null; break; case TipState.New: Show(); break; } }
private void ShowTooltip(Control control) { last_control = control; // Whatever we're displaying right now, we don't want it anymore tooltip_window.Visible = false; timer.Stop(); state = TipState.Initial; if (!is_active) { return; } // ShowAlways controls whether the controls in non-active forms // can display its tooltips, even if they are not current active control. if (!show_always && control.FindForm() != Form.ActiveForm) { return; } string text = (string)tooltip_strings[control]; if (text != null && text.Length > 0) { if (active_control == null) { timer.Interval = Math.Max(initial_delay, 1); } else { timer.Interval = Math.Max(re_show_delay, 1); } active_control = control; timer.Start(); } }
private void timer_Tick(object sender, EventArgs e) { timer.Stop(); switch (state) { case TipState.Initial: if (active_control == null) return; tooltip_window.Present (active_control, (string)tooltip_strings[active_control]); state = TipState.Show; timer.Interval = autopop_delay; timer.Start(); break; case TipState.Show: tooltip_window.Visible = false; state = TipState.Down; break; default: throw new Exception ("Timer shouldn't be running in state: " + state); } }
private void ShowTooltip (Control control) { last_control = control; // Whatever we're displaying right now, we don't want it anymore tooltip_window.Visible = false; timer.Stop(); state = TipState.Initial; if (!is_active) return; // ShowAlways controls whether the controls in non-active forms // can display its tooltips, even if they are not current active control. //if (!show_always && control.FindForm () != Form.ActiveForm) // return; string text = (string)tooltip_strings[control]; if (text != null && text.Length > 0) { if (active_control == null) { timer.Interval = Math.Max (initial_delay, 1); } else { timer.Interval = Math.Max (re_show_delay, 1); } active_control = control; timer.Start (); } }