Example #1
0
    public void RotateLeft(int sides)
    {
        if (!this.rotationAngle.IsTransitioning)
        {
            Time.timeScale = 0;
            this.GetComponent <Future>().schedule(rotationDuration, delegate() {
                Time.timeScale = 1;
                bindRotation(rotationAngle);
                UpdateListeners();
            });

            rotationAngle.GoTo(transform.rotation.eulerAngles.z + leftTurn * sides);
        }
    }
Example #2
0
    public void TransitionToBounds()
    {
        lockToBounds   = false;
        sizeTransition = new TransitionFloat(camera.orthographicSize, 0.5f, TransitionFloat.EASE_OUT);
        xTransition    = new TransitionFloat(transform.position.x, 0.5f, TransitionFloat.EASE_OUT);
        yTransition    = new TransitionFloat(transform.position.y, 0.5f, TransitionFloat.EASE_OUT);
        GetComponent <Future>().schedule(0.5f, delegate() {
            lockToBounds = true;
        });


        List <Vector3> points = new List <Vector3>();

        if (GameManager.Instance.currentOrb != null)
        {
            points.Add(GameManager.Instance.currentOrb.position);
        }
        foreach (PlayerController playerController in GameObject.FindObjectsOfType <PlayerController>())
        {
            points.Add(playerController.transform.position);
        }
        Rect bounds = getMinCameraBounds(points);

        sizeTransition.GoTo(Mathf.Max(Mathf.Max(
                                          bounds.height / 2 * 1.5f,
                                          bounds.width / camera.aspect / 2 * 1.5f),
                                      10));
        xTransition.GoTo(bounds.center.x);
        yTransition.GoTo(bounds.center.y);
    }