Пример #1
0
    /// <summary>
    /// Register the custom late update function.
    /// </summary>

    void Start()
    {
        mBaseRot = Quaternion.Euler(desiredPitch, 0f, 0f);
        mTrans   = transform;
        UpdateTransform(1f);
        SGUpdateManager.AddLateUpdate(0, this, OnLateUpdate);
    }
Пример #2
0
    /// <summary>
    /// Ensure that there is an instance of this class somewhere in the scene.
    /// </summary>

    static void CreateInstance()
    {
        if (mInstance == null)
        {
            GameObject go = new GameObject("_SGUpdateManager");
            mInstance = go.AddComponent <SGUpdateManager>();
            DontDestroyOnLoad(go);
        }
    }
Пример #3
0
 void Start()
 {
     if (!NetworkManager.isConnected || NetworkManager.IsMine(this))
     {
         mTrans = transform;
         mRb    = rigidbody;
         SGUpdateManager.AddLateUpdate(-1, this, OnLateUpdate);
         OnLateUpdate();
     }
     else
     {
         Destroy(this);
     }
 }
Пример #4
0
	/// <summary>
	/// Cache some values and register the
	/// </summary>

	void Start()
	{
		if (cameraToCopy != null)
		{
			mCam = camera;
			mTrans = transform;
			mTarget = cameraToCopy.transform;
			SGUpdateManager.AddLateUpdate(1, this, OnLateUpdate);
		}
		else if (Application.isPlaying)
		{
			Destroy(this);
		}
	}
Пример #5
0
    /// <summary>
    /// Register the late update function.
    /// </summary>

    void Awake()
    {
        mWidgets = gameObject.GetComponentsInChildren <SGWidget>();
        mBars    = gameObject.GetComponentsInChildren <SGProgressBar>();

        if (mWidgets != null)
        {
            foreach (SGWidget w in mWidgets)
            {
                w.color.a = mAlpha * alphaTint;
                w.enabled = w.color.a > 0.01f;
            }
        }

        // Parts of the code rely on updated camera's orientation, so it should be executed after all camera updates.
        SGUpdateManager.AddLateUpdate(3, this, OnLateUpdate);
    }
Пример #6
0
    void OnStart()
    {
        if (instance != null)
        {
            if (!Application.isEditor)
            {
                Debug.LogWarning("Can only have one DistantObjects script in the scene!");
                Destroy(this);
            }
            return;
        }
        instance       = this;
        mTrans         = transform;
        mCamTrans      = Camera.main.transform;
        mCameraOrigin  = mCamTrans.position;
        mInitialOffset = mCameraOrigin - mTrans.position;

        if (Application.isPlaying)
        {
            SGUpdateManager.AddLateUpdate(10, this, CustomUpdate);
        }
    }
Пример #7
0
 /// <summary>
 /// Ensure that there is an instance of this class somewhere in the scene.
 /// </summary>
 static void CreateInstance()
 {
     if (mInstance == null)
     {
         GameObject go = new GameObject("_SGUpdateManager");
         mInstance = go.AddComponent<SGUpdateManager>();
         DontDestroyOnLoad(go);
     }
 }
Пример #8
0
 void OnDestroy()
 {
     mInstance = null;
 }
Пример #9
0
 void Start()
 {
     mTrans = transform;
     SGUpdateManager.AddLateUpdate(2, this, OnLateUpdate);
 }
Пример #10
0
 void OnDestroy()
 {
     mInstance = null;
 }
Пример #11
0
    /// <summary>
    /// Register the late update callback.
    /// </summary>

    void Start()
    {
        SGUpdateManager.AddLateUpdate(4, this, OnLateUpdate);
    }