private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         OnLevelSwitchRequested.Raise(Destination);
     }
 }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Data = EditorGUILayout.TextField("");

        if (GUILayout.Button("Raise"))
        {
            StringGameEvent gameEvent = target as StringGameEvent;
            gameEvent.Raise(Data);
        }
    }
Exemple #3
0
 public void RequestTravel()
 {
     if (Location.IsCurrent)
     {
         OnLevelEntryRequested.Raise(Location.Name);
     }
     else
     {
         if (Location.CanTravelTo)
         {
             OnTravelRequested.Raise(Location.Name);
         }
     }
 }
Exemple #4
0
    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("");
    }
Exemple #5
0
 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("");
 }
Exemple #7
0
 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();
 }