void HandleNewImage(CamHelper camHelper) { if (myTex == null) { SetupImage(camHelper); } myTex.SetPixels(camHelper.tex.GetPixels()); myTex.Apply(); }
void SetupImage(CamHelper camHelper) { myTex = new Texture2D(camHelper.Width, camHelper.Height); mySprite = Sprite.Create( myTex, new Rect(Vector2.zero, new Vector2(camHelper.Width, camHelper.Height)), Vector2.one * 0.5f); mySprite.name = "Photo"; img.sprite = mySprite; }
void HandleCamImageRecorded(CamHelper camHelper) { if (myTex == null) { SetupImage(camHelper); } Fill(backgroundColor); Texture2D tex = camHelper.tex; //TODO: Need to know when all crawlers are done for (int i = 0; i < nCrawlers; i++) { StartCoroutine(Crawl(tex)); } StartCoroutine(TexApplier(tex)); }
void Start() { cAutomata = GetComponent <ColorAutomata> (); cHelper = GetComponent <CamHelper> (); cHelper.Reshape(600, 400); cAutomata.SetupImage(cHelper); mRend = GetComponent <MeshRenderer> (); if (pMaterial == null) { if (mRend.materials.Length > 0) { pMaterial = mRend.materials [mRend.materials.Length - 1]; } } if (pMaterial != null) { pMaterial.SetTexture("_MainTex", cAutomata.Tex); } }
void OnSnap(CamHelper camHelper) { HandleCamImageRecorded(camHelper); }
/// <summary> /// Teleports the player to their map waypoint (purple) not route (yellow) /// </summary> /// <remarks> /// Disables chat and fades out the screen /// </remarks> private void TeleportToWaypoint() { //Sprite 8 is the waypoint blip (purple) var waypointCord = RAGE.Game.Ui.GetFirstBlipInfoId(8); if (waypointCord > 0) { RAGE.Game.Player.StopPlayerTeleport(); ChatHelper.EnableChat(false); CamHelper.SetPlayerLoading(true); //var gametime = RAGE.Game.Utils.Timestep(); var g = RAGE.Game.Misc.GetGameTimer(); Chat.Output($"Game timer: {g}"); //Get waypoint vector var wpPosition = RAGE.Game.Ui.GetBlipInfoIdCoord(waypointCord); RAGE.Game.Entity.SetEntityCoords(_player.Handle, wpPosition.X, wpPosition.Y, 700f, true, false, false, true); //_player.FreezePosition(true); float z = 0f; wpPosition.Z = 1000f; bool groundFound = false; RAGE.Game.Player.StartPlayerTeleport(wpPosition.X, wpPosition.Y, wpPosition.Z, 0f, true, true, false); for (int i = 0; i < 1000f; i++) { Chat.Output($"{i}"); _player.Position.Z = wpPosition.Z; if (RAGE.Game.Misc.GetGroundZFor3dCoord(wpPosition.X, wpPosition.Y, i, ref z, false)) { groundFound = true; if (!RAGE.Game.Player.IsPlayerTeleportActive()) { RAGE.Game.Player.StartPlayerTeleport(wpPosition.X, wpPosition.Y, z, 0f, true, true, false); } _player.Position.Z = wpPosition.Z; Chat.Output($"ground found at ref {z}. count {i}"); break; } wpPosition.Z = z; RAGE.Game.Invoker.Wait(25); } if (!groundFound) { _player.Position.Z = 1000; Chat.Output($"~r~Teleported: {_player.Position.X}, {_player.Position.Y}, {_player.Position.Z}"); } { Chat.Output($"~r~Teleported: {_player.Position.X}, {_player.Position.Y}, {_player.Position.Z}"); } CamHelper.SetPlayerLoading(false, 750); ChatHelper.EnableChat(true); NotifyPic($"Teleported to map waypoint. {_player.Position.ToString()}", "Teleport", RageMpClientShared.NotifyChar.CHAR_BLIMP); } else { Chat.Output($"~r~Set a waypoint..."); } }