private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { OnLevelSwitchRequested.Raise(Destination); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); Data = EditorGUILayout.TextField(""); if (GUILayout.Button("Raise")) { StringGameEvent gameEvent = target as StringGameEvent; gameEvent.Raise(Data); } }
public void RequestTravel() { if (Location.IsCurrent) { OnLevelEntryRequested.Raise(Location.Name); } else { if (Location.CanTravelTo) { OnTravelRequested.Raise(Location.Name); } } }
public void Initialize(string previousSceneName) { // Player PlayerCharacter player = FindObjectOfType <PlayerCharacter>(); if (player == null) { player = Instantiate(PlayerPrefab); } // Put the Player to the correct SpawnPoint foreach (LevelPortal portal in FindObjectsOfType <LevelPortal>()) { if (previousSceneName == portal.Destination) { player.transform.position = portal.SpawnPoint.position; break; } } // Camera CameraController cameraRig = FindObjectOfType <CameraController>(); if (cameraRig == null) { cameraRig = Instantiate(CameraRigPrefab); } cameraRig.Target = player.transform; // UIs if (GameObject.Find("MenuBar") == null) { Instantiate(MenuBarPrefab); } if (FindObjectOfType <PlayerUI>() == null) { Instantiate(PlayerUIPrefab); } if (FindObjectOfType <LevelPortalUI>() == null) { Instantiate(LevelPortalUIPrefab); } if (FindObjectOfType <MarkedEnemyUI>() == null) { Instantiate(MarkedEnemyUIPrefab); } OnSceneReady.Raise(""); }
void TrapObject(GameObject gobject, Vector3Int tile) { if (!trappedObjects.Contains(gobject)) { trappedObjects.Add(gobject); if (gobject.tag == "Player") { gobject.GetComponent <GridController2D>().Trap(tile); PlayerDeathEvent.Raise("The little blob got stuck on a magnet! Try again?"); } else { gobject.GetComponent <gridBlockController2D>().Trap(tile); } } }
public void Enter(string currentLocationName) { Initialize(currentLocationName); OnSceneReady.Raise(""); }
private void UpdateSceneLoad() { // Pass on the previous scene name OnSceneLoaded.Raise(PreviousSceneName); }
public void SwitchLocation() { OnLevelSwitch.Raise(Destination); }
public void RpcSendUserMessage(string message) { MessageReceived.Raise(message); }
public void SwitchLevel() { OnLevelSwitch.Raise(Destination); Close(); }
public void StartTravel() { OnStartTravel.Raise(Destination); Close(); }