void ConsumCoin() { GameObject o = GetTileAtPosition(transform.position); if (o != null) { teleport tile = o.GetComponent <teleport> (); if (tile != null) { if (!tile.didConsume && (tile.isCoin || tile.isExtraCoin)) { o.GetComponent <SpriteRenderer> ().enabled = false; tile.didConsume = true; if (GameMenu.isOnePlayerGame) { GameBoard.playerOneScore += 10; GameObject.Find("Game").transform.GetComponent <GameBoard> ().playerOneCoinsConsumed++; } else { if (GameBoard.isPlayerOneUp) { GameBoard.playerOneScore += 10; GameObject.Find("Game").transform.GetComponent <GameBoard> ().playerTwoCoinsConsumed++; } else { GameBoard.playerTwoScore += 10; GameObject.Find("Game").transform.GetComponent <GameBoard> ().playerTwoCoinsConsumed++; } } PlayChompSound(); if (tile.isExtraCoin) { GameObject[] ghost = GameObject.FindGameObjectsWithTag("Ghost"); foreach (GameObject go in ghost) { go.GetComponent <Ghost> ().StartFrightenedMode(); } } } } } }
public void reset_player_right() { transform.position = new Vector3(15, 0, 0); transform.localScale = new Vector2(0.2f, 0.2f); mana = (int)ManaStrip.maxValue; sizeShrink ss = GetComponent <sizeShrink>(); if (ss != null) { ss.nextCast1 = 0; ss.nextCast2 = 0; ss.nextCast3 = 0; } doorMove dm = GetComponent <doorMove>(); if (dm != null) { dm.nextCast1 = 0; dm.nextCast2 = 0; dm.nextCast3 = 0; } freeze f = GetComponent <freeze>(); if (f != null) { f.nextCast1 = 0; f.nextCast2 = 0; f.nextCast3 = 0; } XMark x = GetComponent <XMark>(); if (x != null) { x.nextCast1 = 0; x.nextCast2 = 0; x.nextCast3 = 0; } evolve e = GetComponent <evolve>(); if (e != null) { e.nextCast1 = 0; e.nextCast2 = 0; e.nextCast3 = 0; } teleport t = GetComponent <teleport>(); if (t != null) { t.nextCast1 = 0; t.nextCast2 = 0; t.nextCast3 = 0; } fireWall fw = GetComponent <fireWall>(); if (fw != null) { fw.nextCast1 = 0; fw.nextCast2 = 0; fw.nextCast3 = 0; } }
public void init() { Process[] teardowns = Process.GetProcessesByName("teardown"); if (teardowns.Length > 0) { //calculate nessicary offsets Process process; IntPtr handle; Int64 playerInstance; Int64 gameInstance; Int32 processHandle; Int64 sceneInstance; process = teardowns[0]; handle = OpenProcess(PROCESS_ALL_ACCESS, false, process.Id); Byte[] buffer = new Byte[8]; Int32 bytesRead = 0; processHandle = (Int32)handle; dbgTxt.AppendText(" Entrypoint : 0x" + processHandle.ToString("X")); dbgTxt.AppendText(Environment.NewLine); Int64 baseAddress = process.MainModule.BaseAddress.ToInt64() + 0x003E4520; buffer = new byte[8]; ReadProcessMemory(processHandle, baseAddress, buffer, buffer.Length, ref bytesRead); gameInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText(" Game instance : 0x" + gameInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); buffer = new byte[8]; Int64 playerPtr = gameInstance + 0xA0; ReadProcessMemory(processHandle, playerPtr, buffer, buffer.Length, ref bytesRead); playerInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText("Player instance : 0x" + playerInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); buffer = new byte[8]; Int64 scenePtr = gameInstance + 0x40; ReadProcessMemory(processHandle, scenePtr, buffer, buffer.Length, ref bytesRead); sceneInstance = BitConverter.ToInt64(buffer, 0); dbgTxt.AppendText(" Scene instance : 0x" + sceneInstance.ToString("X")); dbgTxt.AppendText(Environment.NewLine); int read_vcount = 0; ReadProcessMemory(processHandle, sceneInstance + 0x530, origionalWallCode, origionalWallCode.Length, ref read_vcount); //create the offsetpackage pack = new offsetPackage(process, handle, playerInstance, gameInstance, processHandle, sceneInstance); byte[] defSpeed = BitConverter.GetBytes(1f); WriteProcessMemory(pack.processHandle, pack.playerInstance + 0x0160, defSpeed, defSpeed.Length, ref bytesRead); //put default speed value into unused memory for later //initialise mods removeBoundaries = new removeBoundaries(pack); teleport = new teleport(pack); jetpack = new jetpack(pack); immortality = new immortality(pack); step = new step(pack); fly = new fly(pack); slowmo = new slowmo(pack); this.Text = "Teardown diddler [ACTIVE]"; tc.Enabled = true; gbReapply.Enabled = true; updateCurrentPositions.Start(); } else { this.Text = "Teardown diddler [INACTIVE]"; } }
private void Start() { tp = GetComponent <teleport>(); }
// Start is called before the first frame update void Start() { gameManager = GameObject.Find("game manager"); Map_Menu.SetActive(false); teleportscript = gameManager.GetComponent <teleport>(); }
private void Awake() { instace = this; }
void Start() { //if not provided, use default values if (playerCamera == null) { playerCamera = Camera.main.transform; } if (groupId == "") { groupId = transform.name; } //reference to each portal of this set portalA = transform.GetChild(0); portalB = transform.GetChild(1); //I generate containers for cameras (for pivot points) GameObject containerCamA = new GameObject("cameraContainer"); GameObject containerCamB = new GameObject("cameraContainer"); //and put them inside each portal containerCamA.transform.SetParent(portalA, true); containerCamB.transform.SetParent(portalB, true); //I generate the empty objects for the cameras GameObject objCamA = new GameObject("camera"); GameObject objCamB = new GameObject("camera"); //and put them inside the containers. objCamA.transform.SetParent(containerCamA.transform, true); objCamB.transform.SetParent(containerCamB.transform, true); // (now we have portal>container>empty-obj-camera) //add camera components to the cameras cameraA = objCamA.AddComponent <Camera>(); cameraB = objCamB.AddComponent <Camera>(); //and its scripts portalCamMovement scriptCamA = cameraA.gameObject.AddComponent <portalCamMovement>(); portalCamMovement scriptCamB = cameraB.gameObject.AddComponent <portalCamMovement>(); //I give this new cameras same setup than main camera Camera cameraComp = playerCamera.GetComponent <Camera>(); cameraA.CopyFrom(cameraComp); cameraB.CopyFrom(cameraComp); //I setup both camera's scripts scriptCamA.playerCamera = playerCamera; scriptCamA.thisPortal = portalA; scriptCamA.otherPortal = portalB; scriptCamA.clippingOffset = advanced.clippingOffset; scriptCamA.cameraId = groupId + ".a"; scriptCamB.playerCamera = playerCamera; scriptCamB.thisPortal = portalB; scriptCamB.otherPortal = portalA; scriptCamB.clippingOffset = advanced.clippingOffset; scriptCamB.cameraId = groupId + ".b"; //and setup both portal's script teleport scriptPortalA = portalA.Find("plane").GetComponent <teleport>(); teleport scriptPortalB = portalB.Find("plane").GetComponent <teleport>(); scriptPortalA.setup = this; scriptPortalA.cameraScript = scriptCamA; scriptPortalA.otherScript = scriptPortalB; scriptPortalB.setup = this; scriptPortalB.cameraScript = scriptCamB; scriptPortalB.otherScript = scriptPortalA; //I create materials with the shader //and asign those materials to the planes (here is where they cross) Resize(false); setupComplete = true; portalEvents.setupComplete?.Invoke(groupId, transform); }