コード例 #1
0
ファイル: FollowCamera.cs プロジェクト: stjahns/INTD450
    // Remove first instance of given target from stack,
    // or remove top target of stack
    public void PopTarget(CameraTarget oldTarget = null, float transitionTime = 0)
    {
        CameraTarget currentTarget = targetStack[0];

        if (targetStack.Count > 0)
        {
            if (oldTarget != null)
            {
                targetStack.Remove(oldTarget);
            }
            else
            {
                targetStack.RemoveAt(0);
            }
        }

        if (targetStack.Count > 0 && currentTarget != targetStack[0])
        {
            // camera's changed. Transition to it.
            inTransition = true;
            targetTransitionTime = transitionTime;
            targetTransitionTimer = 0;
            transitionStartPosition = transform.position;
            transitionStartHeight = viewportHeight;

            //viewportHeight = targetStack[0].targetViewportHeight;
            maxViewportHeight = targetStack[0].maxViewportHeight;
            minViewportHeight = targetStack[0].minViewportHeight;
            zoomStepSize = targetStack[0].zoomStepSize;
        }
    }
コード例 #2
0
ファイル: FollowCamera.cs プロジェクト: stjahns/INTD450
    // Add target to top of stack (first element in list)
    public void PushTarget(CameraTarget newTarget, float transitionTime = 0)
    {
        targetStack.Insert(0, newTarget);
        //viewportHeight = newTarget.targetViewportHeight;

        maxViewportHeight = newTarget.maxViewportHeight;
        minViewportHeight = newTarget.minViewportHeight;
        zoomStepSize = newTarget.zoomStepSize;

        targetTransitionTime = transitionTime;
        targetTransitionTimer = 0;
        transitionStartPosition = transform.position;
        transitionStartHeight = viewportHeight;
        inTransition = true;
    }
コード例 #3
0
        /// <summary>
        /// 初始化助手
        /// </summary>
        public void OnInitialization()
        {
            MainCamera          = Module.GetComponentByChild <Camera>("MainCamera");
            _cameraTarget       = Module.GetComponentByChild <CameraTarget>("CameraTarget");
            _mousePosition      = MainCamera.GetComponent <MousePosition>();
            _mouseRotation      = MainCamera.GetComponent <MouseRotation>();
            _mouseRay           = MainCamera.GetComponent <MouseRay>();
            _highlightingEffect = MainCamera.GetComponent <HighlightingEffect>();

            _mousePosition.Target  = _cameraTarget;
            _mousePosition.MR      = _mouseRotation;
            _mousePosition.Manager = Module as ControllerManager;
            _mouseRotation.Target  = _cameraTarget;
            _mouseRotation.Manager = Module as ControllerManager;
            _mouseRay.RayCamera    = MainCamera;
            _mouseRay.RayEvent    += (target, point, point2D) =>
            {
                RayEvent?.Invoke(target, point, point2D);
            };
        }
コード例 #4
0
ファイル: CameraController.cs プロジェクト: douglasZwick/blb
    void FindTarget()
    {
        CancelOffsetMove();

        m_Target = FindObjectOfType <CameraTarget>();

        if (m_Target != null)
        {
            m_TargetDirection = m_Target.GetComponent <TileDirection>();
            m_FacingLeft      = m_TargetDirection.m_Direction == Direction.LEFT;
            m_Offset          = m_FacingLeft ? m_LeftFacingOffset : m_RightFacingOffset;

            var eventData = new CameraControllerEventData()
            {
                m_CameraTarget = m_Target,
            };

            m_Events.FoundTarget.Invoke(eventData);
        }
    }
コード例 #5
0
        /// <summary>
        /// Called when the vehicle camera's camera target changes.
        /// </summary>
        /// <param name="newTarget">The new camera target.</param>
        protected virtual void OnCameraTargetChanged(CameraTarget newTarget)
        {
            if (targetVehicle != null)
            {
                targetVehicle.onDestroyed.RemoveListener(OnVehicleDestroyed);
            }

            if (newTarget != null)
            {
                targetVehicle = newTarget.GetComponent <Vehicle>();
                if (targetVehicle != null)
                {
                    targetVehicle.onDestroyed.AddListener(OnVehicleDestroyed);
                }
            }
            else
            {
                targetVehicle = null;
            }
        }
コード例 #6
0
    private void ResetTunning()
    {
        CameraTarget tractor    = character.GetComponentInChildren <CameraTarget>();
        Drivetrain   drivetrain = tractor.GetComponent <Drivetrain>();

        drivetrain.maxPower  = enemyCar[currentCar].MaxPower;
        drivetrain.maxTorque = enemyCar[currentCar].MaxTorque;
        Axles axles = tractor.GetComponent <Axles>();

        axles.frontAxle.sidewaysGripFactor  = enemyCar[currentCar].Sideways;
        axles.rearAxle.sidewaysGripFactor   = enemyCar[currentCar].Sideways;
        axles.frontAxle.brakeFrictionTorque = enemyCar[currentCar].Brake;
        axles.rearAxle.brakeFrictionTorque  = enemyCar[currentCar].Brake;
        foreach (Axle axle in axles.otherAxles)
        {
            axle.sidewaysGripFactor  = enemyCar[currentCar].Sideways;
            axle.brakeFrictionTorque = enemyCar[currentCar].Brake;
        }
        //tractor.GetComponent<Setup>().SaveSetup();
        maxSpeedIndicator.text = enemyCar[currentCar].MaxSpeed.ToString("f0");
    }
コード例 #7
0
    // Token: 0x06007283 RID: 29315 RVA: 0x00378828 File Offset: 0x00376A28
    public void MHBEPLMQDKK(Transform OGEFDMHQCDB, float DCHDDIDNKPM = 1f, float OLNHHIBFGKL = 1f, Vector2 FOMLEOIJCQN = default(Vector2))
    {
        if (this.PCIPGQNOOKI(OGEFDMHQCDB) != null)
        {
            return;
        }
        CameraTarget cameraTarget = new CameraTarget
        {
            TargetTransform  = OGEFDMHQCDB,
            TargetInfluenceH = DCHDDIDNKPM,
            TargetInfluenceV = OLNHHIBFGKL,
            TargetOffset     = FOMLEOIJCQN
        };

        this.DBLIJKDNBLI.Add(cameraTarget);
        Transform transform = new GameObject(OGEFDMHQCDB.name + "!\r\n").transform;

        this.CIKQEQIGEJI.Add(cameraTarget, transform);
        base.GPONHFNLHCN.HJMBBIGEMNC(transform, 320f, 660f, 230f, default(Vector2));
        base.enabled = false;
    }
コード例 #8
0
        public override void OnInitialization()
        {
            base.OnInitialization();

            DOTween.defaultEaseType = DefaultEase;
            DOTween.defaultAutoPlay = DefaultAutoPlay;
            DOTween.defaultAutoKill = IsAutoKill;

            MainCamera          = transform.GetComponentByChild <Camera>("MainCamera");
            _cameraTarget       = transform.GetComponentByChild <CameraTarget>("CameraTarget");
            _mousePosition      = MainCamera.GetComponent <MousePosition>();
            _mouseRotation      = MainCamera.GetComponent <MouseRotation>();
            _mouseRay           = MainCamera.GetComponent <MouseRay>();
            _highlightingEffect = MainCamera.GetComponent <HighlightingEffect>();

            _mousePosition.Target = _cameraTarget;
            _mousePosition.MR     = _mouseRotation;
            _mouseRotation.Target = _cameraTarget;
            _mouseRay.RayCamera   = MainCamera;
            _mouseRay.RayEvent   += OnRay;
        }
コード例 #9
0
    // Token: 0x0600726E RID: 29294 RVA: 0x00377EA4 File Offset: 0x003760A4
    public void FLFJODEFJCF(Transform OGEFDMHQCDB, float DCHDDIDNKPM = 1f, float OLNHHIBFGKL = 1f, Vector2 FOMLEOIJCQN = default(Vector2))
    {
        if (this.HJQHFDMPBOO(OGEFDMHQCDB) != null)
        {
            return;
        }
        CameraTarget cameraTarget = new CameraTarget
        {
            TargetTransform  = OGEFDMHQCDB,
            TargetInfluenceH = DCHDDIDNKPM,
            TargetInfluenceV = OLNHHIBFGKL,
            TargetOffset     = FOMLEOIJCQN
        };

        this.DBLIJKDNBLI.Add(cameraTarget);
        Transform transform = new GameObject(OGEFDMHQCDB.name + "colorchange").transform;

        this.CIKQEQIGEJI.Add(cameraTarget, transform);
        base.GPONHFNLHCN.HJMBBIGEMNC(transform, 1694f, 423f, 1708f, default(Vector2));
        base.enabled = false;
    }
コード例 #10
0
    // Token: 0x06007288 RID: 29320 RVA: 0x00378AA4 File Offset: 0x00376CA4
    public void EEFLDKIGBLL(Transform OGEFDMHQCDB, float DCHDDIDNKPM = 1f, float OLNHHIBFGKL = 1f, Vector2 FOMLEOIJCQN = default(Vector2))
    {
        if (this.POIQGQGLBIJ(OGEFDMHQCDB) != null)
        {
            return;
        }
        CameraTarget cameraTarget = new CameraTarget
        {
            TargetTransform  = OGEFDMHQCDB,
            TargetInfluenceH = DCHDDIDNKPM,
            TargetInfluenceV = OLNHHIBFGKL,
            TargetOffset     = FOMLEOIJCQN
        };

        this.DBLIJKDNBLI.Add(cameraTarget);
        Transform transform = new GameObject(OGEFDMHQCDB.name + "_OnRails").transform;

        this.CIKQEQIGEJI.Add(cameraTarget, transform);
        base.GPONHFNLHCN.HJMBBIGEMNC(transform, 1f, 1f, 0f, default(Vector2));
        base.enabled = true;
    }
コード例 #11
0
    // Token: 0x06007257 RID: 29271 RVA: 0x00377638 File Offset: 0x00375838
    public void PEHBEIKQJPJ(Transform OGEFDMHQCDB, float DCHDDIDNKPM = 1f, float OLNHHIBFGKL = 1f, Vector2 FOMLEOIJCQN = default(Vector2))
    {
        if (this.MFOLBIDKCFE(OGEFDMHQCDB) != null)
        {
            return;
        }
        CameraTarget cameraTarget = new CameraTarget
        {
            TargetTransform  = OGEFDMHQCDB,
            TargetInfluenceH = DCHDDIDNKPM,
            TargetInfluenceV = OLNHHIBFGKL,
            TargetOffset     = FOMLEOIJCQN
        };

        this.DBLIJKDNBLI.Add(cameraTarget);
        Transform transform = new GameObject(OGEFDMHQCDB.name + " lost its focus and couldn't move!\r\n").transform;

        this.CIKQEQIGEJI.Add(cameraTarget, transform);
        base.GPONHFNLHCN.HJMBBIGEMNC(transform, 1640f, 656f, 1875f, default(Vector2));
        base.enabled = false;
    }
コード例 #12
0
    /// <summary>
    /// The camera has reached the target rotation.
    /// </summary>
    private void CameraTargetRotationReached(CameraTarget target, TargetParameters.StaticTargetRotationParameters parameters)
    {
        Rotating = false;
        Debug.Log("ROTATION REACHED");

        switch (parameters.SteadyCamOnEnd)
        {
        case SteadyCamBehaviour.Ignore:
            return;

        case SteadyCamBehaviour.TurnOnAndOverride:
            if (steadyCamCoroutine == null)
            {
                ActivateSteadyCam(parameters.EndSCParameters);
            }
            else
            {
                steadyCamParameters = parameters.EndSCParameters;
            }
            break;

        case SteadyCamBehaviour.TurnOff:
            if (steadyCamCoroutine != null)
            {
                StopCoroutine(steadyCamCoroutine);
                StartCoroutine(RecenterCamera());
            }
            break;

        case SteadyCamBehaviour.OverrideIfOn:
            if (steadyCamCoroutine != null)
            {
                steadyCamParameters = parameters.EndSCParameters;
            }
            break;
        }

        Debug.Log(rotationCoroutine != null);
    }
コード例 #13
0
        void Start()
        {
            // Camera
            m_CameraBody.gameObject.SetActive(false);
            m_DesiredTarget             = CameraTarget.From(m_CameraBody);
            m_Camera.transform.position = m_DesiredTarget.pos;
            m_Camera.transform.rotation = m_DesiredTarget.rot;
            m_TargetBody = CameraTarget.From(m_CameraBody);
            m_TargetHead = CameraTarget.From(m_CameraHead);
            m_TargetButt = CameraTarget.From(m_CameraButt);

            // Reset all controls
            foreach (var group in Resources.FindObjectsOfTypeAll <ToggleGroup>())
            {
                var    toggles = group.GetComponentsInChildren <Toggle>(true);
                Toggle first   = null;
                if (toggles.Length > 0)
                {
                    first = toggles.Single(tg => tg.group == group && tg.isOn);
                }
                group.SetAllTogglesOff();
                if (first)
                {
                    first.isOn = false;
                    first.isOn = true;
                    first.onValueChanged.Invoke(true);
                }
            }
            foreach (var slider in Resources.FindObjectsOfTypeAll <Slider>())
            {
                slider.onValueChanged.Invoke(slider.value);
            }
            foreach (var xy in Resources.FindObjectsOfTypeAll <XYControl>())
            {
                xy.SetValue(Vector2.one * .5f);
            }
        }
コード例 #14
0
    IEnumerator PortalCinematic()
    {
        Camera.main.GetComponent <ProCamera2D>().AddCameraTarget(gameObject.transform, 1, 1, 1);

        CameraTarget playerTarget = Camera.main.GetComponent <ProCamera2D>().GetCameraTarget(Player.transform);

        Camera.main.GetComponent <ProCamera2D>().AdjustCameraTargetInfluence(playerTarget, 0, 0, 1);

        Camera.main.GetComponent <ProCamera2DForwardFocus>().enabled = false;

        Player.GetComponent <PlayerPrototype>().enabled = false;

        SFXMan.PlayLevelCompleteSound();

        yield return(new WaitForSeconds(3));

        Camera.main.GetComponent <ProCamera2DForwardFocus>().enabled = true;

        Camera.main.GetComponent <ProCamera2D>().AdjustCameraTargetInfluence(playerTarget, 1, 1, 1);

        Camera.main.GetComponent <ProCamera2D>().RemoveCameraTarget(gameObject.transform, 1);

        Player.GetComponent <PlayerPrototype>().enabled = true;
    }
コード例 #15
0
        public CameraAddTarget(Environment environment, BaseEvent eventFrame, Character caster)
        {
            this.environment = environment;
            this.eventFrame  = eventFrame;

            CameraAction ca = (CameraAction)eventFrame.ShowAction();

            atf = (CameraAction.AddTargetFx)ca.fx;
            Character target = environment.FindNearbyCharacters(
                caster, Vector3.zero, 999,
                new[] { FindingFilter.ExcludeMe, FindingFilter.ExcludeDead, FindingFilter.ExcludeAllies }
                )[0];

            joint = target.GameObject().transform.FindDeepChild(atf.joint);
            pc2d  = environment.GetCamera().GetComponent <ProCamera2D>();
            casterCameraTarget = pc2d.CameraTargets[0];
            originalX          = casterCameraTarget.TargetInfluenceH;
            originalY          = casterCameraTarget.TargetInfluenceV;
            casterCameraTarget.TargetInfluenceH = atf.curInfX;
            casterCameraTarget.TargetInfluenceV = atf.curInfY;
            cameraTarget = pc2d.AddCameraTarget(
                joint, atf.influenceY, atf.influenceX, atf.translationDuration
                );
        }
コード例 #16
0
		/// <summary>
		/// tweens the Cameras backgroundColor property
		/// </summary>
		/// <returns>The kbackground color to.</returns>
		/// <param name="self">Self.</param>
		/// <param name="to">To.</param>
		/// <param name="duration">Duration.</param>
		public static ITween<Color> ZKbackgroundColorTo( this Camera self, Color to, float duration = 0.3f )
		{
			var tweenTarget = new CameraTarget( self );
			var tween = ZestKit.cacheColorTweens ? QuickCache<ColorTween>.pop() : new ColorTween();
			tween.initialize( tweenTarget, self.backgroundColor, to, duration );

			return tween;
		}
コード例 #17
0
    private void SetCameraStaticTargetRotation(CameraTarget target, TargetParameters.StaticTargetRotationParameters parameters)
    {
        if (rotationCoroutine != null)
        {
            StopCoroutine(rotationCoroutine);
        }

        switch (parameters.CameraExecutionMode)
        {
        case CameraExecutionMode.Immediate:
            ImmediateRotating(target, parameters);
            break;

        case CameraExecutionMode.ConstantLerp:
            rotationCoroutine = StartCoroutine(ConstantLerpRotating(target, parameters));
            break;

        case CameraExecutionMode.NormalLerp:
            rotationCoroutine = StartCoroutine(NormalLerpRotating(target, parameters));
            break;

        case CameraExecutionMode.SmoothLerp:
            rotationCoroutine = StartCoroutine(SmoothLerpRotating(target, parameters));
            break;

        case CameraExecutionMode.CustomLerp:
            rotationCoroutine = StartCoroutine(customStaticRotatingLerp(target, parameters));
            break;
        }

        Rotating = true;

        switch (parameters.SteadyCamOnStart)
        {
        case SteadyCamBehaviour.Ignore:
            return;

        case SteadyCamBehaviour.TurnOnAndOverride:
            if (steadyCamCoroutine == null)
            {
                ActivateSteadyCam(parameters.StartSCParameters);
            }
            else
            {
                steadyCamParameters = parameters.StartSCParameters;
            }
            break;

        case SteadyCamBehaviour.TurnOff:
            if (steadyCamCoroutine != null)
            {
                StopCoroutine(steadyCamCoroutine);
                StartCoroutine(RecenterCamera());
            }
            break;

        case SteadyCamBehaviour.OverrideIfOn:
            if (steadyCamCoroutine != null)
            {
                steadyCamParameters = parameters.StartSCParameters;
            }
            break;
        }
    }
コード例 #18
0
ファイル: World.cs プロジェクト: AlanFoster/Game-of-Life
 private CameraTarget GetCameraTarget(WorldObject worldObject)
 {
     var cameraTarget = new CameraTarget(worldObject, _cameraTargetArrow, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
     cameraTarget.SetColorState(ColorState.Glow);
     cameraTarget.ListenMouseDown += (target, location) => PanCameraToObject(worldObject);
     return cameraTarget;
 }
コード例 #19
0
 void OnEnable()
 {
     targetInstance = FindObjectOfType <CameraTarget>();
     UpdateButtonStatus();
 }
コード例 #20
0
 private void SetTunningButtons(CameraTarget tractor)
 {
   buttonTuningEng.drivetrain = tractor.GetComponent<Drivetrain>();
   buttonTuningHand.axles = tractor.GetComponent<Axles>();
   buttonTuningHand.carDynamics = tractor.GetComponent<CarDynamics>();
   buttonTuningBrake.axles = tractor.GetComponent<Axles>();
   buttonTuningBrake.carDynamics = tractor.GetComponent<CarDynamics>();
   buttonTuningEng.TunStep = enemyCar[currentCar].TunSpeed;
   buttonTuningHand.TunStep = enemyCar[currentCar].TunHandling;
   buttonTuningBrake.TunStep = enemyCar[currentCar].TunBrake;
 }
コード例 #21
0
	void Start () 
    {
        conversationTarget = Instantiate<GameObject>(conversationTargetPrefab.gameObject).GetComponent<CameraTarget>();
        camera = FindObjectOfType<CameraFollow>();
        dialog = FindObjectOfType<DialogBox>();   
	}
コード例 #22
0
        /// <summary>
        /// tweens the Cameras rect property
        /// </summary>
        /// <returns>The krect to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween<Rect> ZKrectTo( this Camera self, Rect to, float duration = 0.3f )
        {
            var tweenTarget = new CameraTarget( self, CameraTarget.CameraTargetType.Rect );
            var tween = RectTween.create();
            tween.initialize( tweenTarget, self.rect, to, duration );

            return tween;
        }
コード例 #23
0
        /// <summary>
        /// tweens the Cameras fieldOfView
        /// </summary>
        /// <returns>The kfield of view to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween<float> ZKfieldOfViewTo( this Camera self, float to, float duration = 0.3f )
        {
            var tweenTarget = new CameraTarget( self, CameraTarget.CameraTargetType.FieldOfView );
            var tween = FloatTween.create();
            tween.initialize( tweenTarget, self.fieldOfView, to, duration );

            return tween;
        }
コード例 #24
0
		/// <summary>
		/// tweens the Cameras fieldOfView
		/// </summary>
		/// <returns>The kfield of view to.</returns>
		/// <param name="self">Self.</param>
		/// <param name="to">To.</param>
		/// <param name="duration">Duration.</param>
		public static ITween<float> ZKfieldOfViewTo( this Camera self, float to, float duration = 0.3f )
		{
			var tweenTarget = new CameraTarget( self, CameraTarget.CameraTargetType.FieldOfView );
			var tween = ZestKit.cacheFloatTweens ? QuickCache<FloatTween>.pop() : new FloatTween();
			tween.initialize( tweenTarget, self.fieldOfView, to, duration );

			return tween;
		}
コード例 #25
0
 /// <summary>
 /// Immediately rotate the camera to match the target rotation.
 /// </summary>
 private void ImmediateRotating(CameraTarget target, TargetParameters.StaticTargetRotationParameters parameters)
 {
     transform.rotation = target.transform.rotation;
     CameraEventSystem.CameraTargetRotationReached(target, parameters);
 }
コード例 #26
0
 public void SetDynamicCameraTarget(CameraTarget cameraTarget, TargetParameters.DynamicTargetPositionParameters posParameters, TargetParameters.DynamicTargetRotationParameters rotParameters)
 {
     CameraEventSystem.SetCameraDynamicTargetPosition(cameraTarget.gameObject, posParameters);
     CameraEventSystem.SetCameraDynamicTargetRotation(cameraTarget.gameObject, rotParameters);
 }
コード例 #27
0
 public void SetStaticCameraTarget(CameraTarget cameraTarget, TargetParameters.StaticTargetPositionParameters posParameters, TargetParameters.StaticTargetRotationParameters rotParameters)
 {
     CameraEventSystem.SetCameraStaticTargetPosition(cameraTarget, posParameters);
     CameraEventSystem.SetCameraStaticTargetRotation(cameraTarget, rotParameters);
 }
コード例 #28
0
 public void SetStaticCameraTarget(CameraTarget cameraTarget, TargetParameters.StaticTargetRotationParameters parameters)
 {
     CameraEventSystem.SetCameraStaticTargetRotation(cameraTarget, parameters);
 }
コード例 #29
0
		/// <summary>
		/// tweens the Cameras orthographicSize
		/// </summary>
		/// <returns>The korthographic size to.</returns>
		/// <param name="self">Self.</param>
		/// <param name="to">To.</param>
		/// <param name="duration">Duration.</param>
		public static ITween<float> ZKorthographicSizeTo( this Camera self, float to, float duration = 0.3f )
		{
			var tweenTarget = new CameraTarget( self, CameraTarget.CameraTargetType.OrthographicSize );
			var tween = ZestKit.cacheFloatTweens ? QuickCache<FloatTween>.pop() : new FloatTween();
			tween.initialize( tweenTarget, self.orthographicSize, to, duration );

			return tween;
		}
コード例 #30
0
        /// <summary>
        /// tweens the Cameras orthographicSize
        /// </summary>
        /// <returns>The korthographic size to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween<float> ZKorthographicSizeTo( this Camera self, float to, float duration = 0.3f )
        {
            var tweenTarget = new CameraTarget( self, CameraTarget.CameraTargetType.OrthographicSize );
            var tween = FloatTween.create();
            tween.initialize( tweenTarget, self.orthographicSize, to, duration );

            return tween;
        }
コード例 #31
0
 public static void SetCameraStaticTargetRotation(CameraTarget targetRotation, TargetParameters.StaticTargetRotationParameters parameters)
 {
     SetCameraStaticTargetRotationEvent.Invoke(targetRotation, parameters);
 }
コード例 #32
0
 // Use this for initialization
 void Start()
 {
     camTransform = transform;
     camTarget    = target.GetComponent <CameraTarget> ();
 }
コード例 #33
0
 // Start is called before the first frame update
 void Start()
 {
     TheBounds = GetComponent <BoxCollider2D>();
     Camera    = FindObjectOfType <CameraTarget>();
     Camera.SetBounds(TheBounds);
 }
コード例 #34
0
        /// <summary>
        /// tweens the Cameras backgroundColor property
        /// </summary>
        /// <returns>The kbackground color to.</returns>
        /// <param name="self">Self.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        public static ITween<Color> ZKbackgroundColorTo( this Camera self, Color to, float duration = 0.3f )
        {
            var tweenTarget = new CameraTarget( self );
            var tween = ColorTween.create();
            tween.initialize( tweenTarget, self.backgroundColor, to, duration );

            return tween;
        }
コード例 #35
0
    /// <summary>
    /// Calculate new camera position
    /// </summary>
    private void FindAveragePosition()
    {
        // Final position
        Vector3 averagePos         = new Vector3();
        int     activeTargetAmount = 0;
        float   minX = 0;
        float   maxX = 0;
        float   minY = 0;
        float   maxY = 0;

        // For each target
        for (int i = 0; i < targetList.Count; i++)
        {
            CameraTarget target = targetList[i];

            // Check target is active
            if (!target || !target.gameObject.activeSelf)
            {
                continue;
            }

            // Set first target as min max position
            if (i == 0)
            {
                minX = maxX = target.transform.position.x;
                minY = maxY = target.transform.position.y;
            }
            else
            {
                // Extends min max bounds
                minX = (target.transform.position.x < minX) ? target.transform.position.x : minX;
                maxX = (target.transform.position.x > maxX) ? target.transform.position.x : maxX;
                minY = (target.transform.position.y < minY) ? target.transform.position.y : minY;
                maxY = (target.transform.position.y > maxY) ? target.transform.position.y : maxY;
            }

            activeTargetAmount++;
        }

        // Find middle point for all targets
        if (activeTargetAmount > 0)
        {
            averagePos.x = (minX + maxX) / 2.0F;
            averagePos.y = (minY + maxY) / 2.0F;
        }

        // If no targets, select fallback focus
        if (targetList.Count == 0)
        {
            if (fallBackTarget && fallBack)
            {
                averagePos = fallBackTarget.position;
            }
        }

        // Calculate zoom
        float dist = Mathf.Max(Mathf.Abs(maxX - minX), Mathf.Abs(maxY - minY));

        averagePos.z = (targetList.Count > 1) ? -Mathf.Min(Mathf.Max(minZoom, dist + borderMargin), maxZoom) : -defaultZoom;

        // Change camera target
        averageTargetPosition = averagePos + new Vector3(0, offset, 0);
    }
コード例 #36
0
 //Add a new object to the list of targets that should be kept in view.
 public void AddObject(CameraTarget obj)
 {
     lookTargets.Add(obj);
     lookWeight += obj.weight;
 }
コード例 #37
0
    private void Start()
    {
        instance = this;

        moveCam = false;
    }
コード例 #38
0
 //Remove an object from the list of targets that should be kept in view.
 public void RemoveObject(CameraTarget obj)
 {
     lookTargets.Remove(obj);
     lookWeight -= obj.weight;
 }
コード例 #39
0
 public static void CameraTargetRotationReached(CameraTarget reachedTarget, TargetParameters.StaticTargetRotationParameters parameters)
 {
     CameraTargetRotationReachedEvent.Invoke(reachedTarget, parameters);
 }
コード例 #40
0
 protected virtual void Awake() => cameraTarget = GetComponent <CameraTarget>();
コード例 #41
0
ファイル: CameraTarget.cs プロジェクト: CaelumLaron/CGJ
#pragma warning restore 0219, 414

    private void OnEnable()
    {
        this._sCameraTarget = this.target as CameraTarget;
    }
コード例 #42
0
 // Use this for initialization
 void Start()
 {
     camTr = GetComponent <CameraTarget>();
 }