protected virtual void OnDestroy() { CameraHook.RemovePreCullEventListener(new CameraHook.PreCullEvent(this.PreCull)); if (!this.AutoDestroyUIObject) { return; } GameUtility.DestroyGameObject((Component)this.UIObject); }
/// <summary> /// Start is called before the first frame update /// </summary> void Start() { animator = GetComponent <Animator>(); camHook = GetComponentInChildren <CameraHook>(); collecter = GetComponent <ItemCollecter>(); EventManager.carEnter += OnCarEnter; canToggleInv = true; }
public override void OnLevelLoaded(LoadMode mode) { if (mode != LoadMode.NewGame && mode != LoadMode.LoadGame) { return; } var cameraController = GameObject.FindObjectOfType <CameraController>(); hook = cameraController.gameObject.AddComponent <CameraHook>(); }
public static void AddPreCullEventListener(CameraHook.PreCullEvent e) { if (e == null) { return; } if (Application.get_isPlaying()) { CameraHook.Inject(); } CameraHook.mPreCullEventListeners += e; }
private void OnPreCull() { if (Application.get_isPlaying()) { M0 component = ((Component)this).GetComponent <Camera>(); ((Camera)component).set_cullingMask(((Camera)component).get_cullingMask() & ~(1 << GameUtility.LayerHidden)); } if (CameraHook.mPreCullEventListeners == null) { return; } CameraHook.mPreCullEventListeners((Camera)((Component)this).GetComponent <Camera>()); }
private void Start() { int[] values = (int[])Enum.GetValues(typeof(RenderTextureFormat)); if (GameUtility.IsDebugBuild) { string str = string.Empty; for (int index = 0; index < values.Length; ++index) { if (SystemInfo.SupportsRenderTextureFormat((RenderTextureFormat)index)) { str = str + ((Enum)(object)(RenderTextureFormat)index).ToString() + " "; } } Debug.Log((object)("Supported RenderTexture Formats: " + str)); } CameraHook.Inject(); }
// Update is called once per frame void Update() { Transform hook = target.transform.Find("CamHook"); CameraHook h = hook.gameObject.GetComponent <CameraHook>(); float dist = (hook.position - transform.position).magnitude; if (h.follow && dist > 0f) { Vector3 pos = Vector3.Lerp(transform.position, hook.position, Time.deltaTime); transform.position = pos; } else { h.follow = false; } transform.LookAt(target.transform.position + (Vector3.up * 1.5f)); }
public void Awake() { instance = this; config = Configuration.Deserialize(configPath); if (config == null) { config = new Configuration(); } currentSSAAFactor = userSSAAFactor = config.ssaaFactor; SaveConfig(); cameraController = FindObjectOfType <CameraController>(); bgTexture = new Texture2D(1, 1); bgTexture.SetPixel(0, 0, Color.grey); bgTexture.Apply(); }
protected virtual void Start() { if (Object.op_Equality((Object)this.UIObject, (Object)null) && !string.IsNullOrEmpty(this.UIObjectID)) { GameObject gameObject = GameObjectID.FindGameObject(this.UIObjectID); if (Object.op_Inequality((Object)gameObject, (Object)null)) { this.UIObject = (RectTransform)gameObject.GetComponent <RectTransform>(); } } if (Object.op_Equality((Object)this.mCanvas, (Object)null) && Object.op_Inequality((Object)this.UIObject, (Object)null)) { this.mCanvas = (Canvas)((Component)this.UIObject).GetComponentInParent <Canvas>(); } if (Object.op_Inequality((Object)this.mCanvas, (Object)null) && Object.op_Equality((Object)this.UIObject, (Object)null)) { this.UIObject = new GameObject(((Object)((Component)this).get_gameObject()).get_name(), new System.Type[1] { typeof(RectTransform) }).get_transform() as RectTransform; ((Transform)this.UIObject).SetParent(((Component)this.mCanvas).get_transform(), false); } CameraHook.AddPreCullEventListener(new CameraHook.PreCullEvent(this.PreCull)); }
private void OnDisable() { CameraHook.RemovePreCullEventListener(new CameraHook.PreCullEvent(this.PreCull)); }
private void OnEnable() { CameraHook.AddPreCullEventListener(new CameraHook.PreCullEvent(this.PreCull)); }