Example #1
0
 /// <summary>
 /// On awake, we initialize our stuff
 /// </summary>
 protected override void Awake()
 {
     Initialize();
     _renderer = GetComponent <Renderer>();
     _rigidbodyInterface.IsKinematic(true);
     _flameAnimator     = Flame.GetComponent <Animator>();
     _explosionAnimator = Explosion.GetComponent <Animator>();
     _camera            = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraBehavior>();
 }
        /// <summary>
        /// Adds 2 buttons to the camera's inspector that allow for easier setup.
        /// Just position the camera at the min or max position you'd like it to have ingame, and press the corresponding button.
        /// It will auto-fill the corresponding variables.
        /// </summary>

        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            CameraBehavior _cameraBehavior = (CameraBehavior)target;

            if (GUILayout.Button("Set Current Camera Position as Minimum Zoom"))
            {
                _cameraBehavior.MinimumZoom             = _cameraBehavior.transform.position;
                _cameraBehavior.MinimumZoomOrthographic = _cameraBehavior.GetComponent <Camera>().orthographicSize;
            }
            if (GUILayout.Button("Set Current Camera Position as Maximum Zoom"))
            {
                _cameraBehavior.MaximumZoom             = _cameraBehavior.transform.position;
                _cameraBehavior.MaximumZoomOrthographic = _cameraBehavior.GetComponent <Camera>().orthographicSize;
            }
        }
Example #3
0
 /// <summary>
 /// On start, we store the explosion's animator and the camera for further use
 /// </summary>
 void Start()
 {
     _explosionAnimator = Explosion.GetComponent <Animator>();
     _camera            = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraBehavior>();
 }