123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using UnityEngine;
- public class CameraChase : MonoBehaviour
- {
- public void StartChase(bool f_bOnece, float f_fTime, Vector3 f_vWorldOffset)
- {
- this.m_bOnece = f_bOnece;
- this.m_fTime = f_fTime;
- this.m_fNowTime = 0f;
- this.m_camMain = GameMain.Instance.MainCamera;
- this.m_trMy = base.gameObject.transform;
- this.m_vWorldOffset = f_vWorldOffset;
- if (this.m_camMain != null)
- {
- this.m_camMain.SetTargetPos(this.m_trMy.position + this.m_vWorldOffset, true);
- }
- }
- public void OnDisable()
- {
- UnityEngine.Object.Destroy(this);
- }
- private void Update()
- {
- if (this.m_camMain != null)
- {
- this.m_camMain.SetTargetPos(this.m_trMy.position + this.m_vWorldOffset, true);
- }
- if (this.m_bOnece && this.m_fTime <= (this.m_fNowTime += Time.deltaTime))
- {
- UnityEngine.Object.Destroy(this);
- }
- }
- private bool m_bOnece = true;
- private float m_fTime;
- private float m_fNowTime;
- private CameraMain m_camMain;
- private Transform m_trMy;
- private Vector3 m_vWorldOffset;
- }
|