public void registerCamera(CameraEdgeController cam) { cornerMap.Add(cam.screenCorner, cam); if (cornerMap.Count >= 4) { ScanForMainPlayer(); GeneratePlayerClones(); } }
public void TriggerDespawnEvent(CameraEdgeController alerted, EdgeCheck edge) { if (UseWarp) { if (true && !alerted.containsPoint(alerted.attachedPlayer.transform.position)) //TODO: If no other camera edge controls this player { CameraPlayerMap[alerted].gameObject.SetActive(false); } } }
public void TriggerSpawnEvent(CameraEdgeController alerted, EdgeCheck edge) //Gets called when this camera's edge collider detects the player { if (UseWarp) { WarpTo destination = alerted.getWarp(edge.dir); if (!CameraPlayerMap[destination.cam].gameObject.activeInHierarchy) //If no other camera is currently using this player { PlayerMovement Clone = CameraPlayerMap[destination.cam]; PlayerMovement Source = CameraPlayerMap[alerted]; Vector3 offset = edge.transform.position - Source.transform.position; Clone.transform.position = destination.edge.transform.position - offset; Clone.gameObject.SetActive(true); Clone.GetComponent <Rigidbody2D>().velocity = Source.GetComponent <Rigidbody2D>().velocity; //TODO: Keep player variables consistent //Clone.CopyState(Source); } } }
void Start() { cameraParent = GetComponentInParent <CameraEdgeController>(); }
public WarpTo(CameraEdgeController newCam, EdgeCheck newEdge) { cam = newCam; edge = newEdge; }