Example #1
0
 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>();
    }
Example #3
0
    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;
        }
    }
Example #4
0
    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;
        }
    }
Example #5
0
    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();
        }
    }
Example #6
0
    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;
        }
    }
Example #7
0
 protected override void AfterEnterNewBound(DisplayBounds bounds)
 {
     script.enabled = true;
 }
Example #8
0
 protected abstract void AfterExitExistingBound(DisplayBounds removedBounds);
Example #9
0
 protected abstract void AfterEnterNewBound(DisplayBounds newBounds);
Example #10
0
 public bool ContainsBounds(DisplayBounds bounds)
 {
     return(inBounds.Contains(bounds));
 }
 void Awake()
 {
     _displayBounds = GameObject.Find("DisplayPlane").GetComponent<DisplayBounds>();
     _stylusSelector = GameObject.Find("ZSStylusSelector").GetComponent<ZSStylusSelector>();
 }