protected override void AfterExitExistingBound(DisplayBounds bounds) { if (NumberOfBounds == 0) { script.enabled = false; } }
protected override void OnScriptAwake() { base.OnScriptAwake(); _core = GameObject.Find("ZSCore").GetComponent<ZSCore>(); if (Target == null) _displayBounds = GameObject.Find("DisplayPlane").GetComponent<DisplayBounds>(); }
protected override void AfterEnterNewBound(DisplayBounds bounds) { if (NumberOfBounds == 1) { // Turn the rigidbody into dynamic body.bodyType = RigidbodyType2D.Dynamic; // Apply the last held velocity to the body body.velocity = lastActiveVelocity; body.angularVelocity = lastAngularVelocity; } }
public void ExitBound(DisplayBounds bounds) { if (inBounds.Remove(bounds)) { // Find the highest priority bound UpdateHighestPriorityBound(); AfterExitExistingBound(bounds); // Unbind to their event AfterWindowOrderChanged(); bounds.OnFloatedToTop -= OnWindowChange; } }
public void EnterBound(DisplayBounds bounds) { if (inBounds.Add(bounds)) { // Find the highest priority bound UpdateHighestPriorityBound(); AfterEnterNewBound(bounds); // Unbind to their event bounds.OnFloatedToTop += OnWindowChange; AfterWindowOrderChanged(); } }
protected override void AfterExitExistingBound(DisplayBounds bounds) { if (NumberOfBounds == 0) { // Store velocity lastActiveVelocity = body.velocity; lastAngularVelocity = body.angularVelocity; // Turn the rigidbody into a kinematic body.bodyType = RigidbodyType2D.Kinematic; // Force the object to stop body.velocity = Vector2.zero; body.angularVelocity = 0; } }
protected override void AfterEnterNewBound(DisplayBounds bounds) { script.enabled = true; }
protected abstract void AfterExitExistingBound(DisplayBounds removedBounds);
protected abstract void AfterEnterNewBound(DisplayBounds newBounds);
public bool ContainsBounds(DisplayBounds bounds) { return(inBounds.Contains(bounds)); }
void Awake() { _displayBounds = GameObject.Find("DisplayPlane").GetComponent<DisplayBounds>(); _stylusSelector = GameObject.Find("ZSStylusSelector").GetComponent<ZSStylusSelector>(); }