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

        Data = EditorGUILayout.TextField("");

        if (GUILayout.Button("Raise"))
        {
            StringGameEvent gameEvent = target as StringGameEvent;
            gameEvent.Raise(Data);
        }
    }
Exemplo n.º 3
0
 public void RequestTravel()
 {
     if (Location.IsCurrent)
     {
         OnLevelEntryRequested.Raise(Location.Name);
     }
     else
     {
         if (Location.CanTravelTo)
         {
             OnTravelRequested.Raise(Location.Name);
         }
     }
 }
Exemplo n.º 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("");
    }
Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 6
0
 public void Enter(string currentLocationName)
 {
     Initialize(currentLocationName);
     OnSceneReady.Raise("");
 }
Exemplo n.º 7
0
 private void UpdateSceneLoad()
 {
     // Pass on the previous scene name
     OnSceneLoaded.Raise(PreviousSceneName);
 }
 public void SwitchLocation()
 {
     OnLevelSwitch.Raise(Destination);
 }
Exemplo n.º 9
0
 public void RpcSendUserMessage(string message)
 {
     MessageReceived.Raise(message);
 }
Exemplo n.º 10
0
 public void SwitchLevel()
 {
     OnLevelSwitch.Raise(Destination);
     Close();
 }
Exemplo n.º 11
0
 public void StartTravel()
 {
     OnStartTravel.Raise(Destination);
     Close();
 }