示例#1
0
    public void OnLeftRoom(AOTEventArgs args)
    {
        print("OnLeftRoom");
        if (Application.loadedLevel != 0)
        {
            Time.timeScale = 1f;
            if (PhotonNetwork.connected)
            {
                PhotonNetwork.Disconnect();
            }

            IN_GAME_MAIN_CAMERA.GameType = GameType.Stop;
            gameStart           = false;
            Screen.lockCursor   = false;
            Screen.showCursor   = true;
            InputManager.MenuOn = false;
            levelSkin           = null;
            DestroyAllExistingCloths();
            Destroy(FGM);
            Application.LoadLevel("menu");
        }

        RespawnPositions.Dispose();
        RCManager.racingSpawnPointSet = false;
    }
示例#2
0
 private void Start()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
示例#3
0
    private void OnLevelWasLoaded(int level)
    {
        if (level == 0)
        {
            return;
        }

        if (Application.loadedLevelName == "characterCreation" || Application.loadedLevelName == "SnapShot")
        {
            return;
        }

        var array = GameObject.FindGameObjectsWithTag("titan");

        foreach (var go in array)
        {
            if (go.GetPhotonView() == null || !go.GetPhotonView().owner.IsMasterClient)
            {
                Destroy(go);
            }
        }

        gameStart = true;
        Pool.Clear();
        RespawnPositions.Dispose();
        ShowHUDInfoCenter(string.Empty);
        var gameObject2 = (GameObject)Instantiate(CacheResources.Load("MainCamera_mono"),
                                                  CacheGameObject.Find("cameraDefaultPosition").transform.position,
                                                  CacheGameObject.Find("cameraDefaultPosition").transform.rotation);

        Destroy(CacheGameObject.Find("cameraDefaultPosition"));
        gameObject2.name  = "MainCamera";
        Screen.lockCursor = true;
        Screen.showCursor = true;
        var ui = (GameObject)Instantiate(CacheResources.Load("UI_IN_GAME"));

        ui.name = "UI_IN_GAME";
        ui.SetActive(true);
        UIRefer = ui.GetComponent <UIReferArray>();
        NGUITools.SetActive(UIRefer.panels[0], true);
        NGUITools.SetActive(UIRefer.panels[1], false);
        NGUITools.SetActive(UIRefer.panels[2], false);
        NGUITools.SetActive(UIRefer.panels[3], false);
        IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition();
        IN_GAME_MAIN_CAMERA.MainCamera.setDayLight(IN_GAME_MAIN_CAMERA.DayLight);
        var info = Level;

        ClothFactory.ClearClothCache();
        logic.OnGameRestart();
        PlayerList = new PlayerList();
        if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single)
        {
            LoadSkinCheck();
            CustomLevel.OnLoadLevel();
            singleKills = 0;
            singleMax   = 0;
            singleTotal = 0;
            IN_GAME_MAIN_CAMERA.MainCamera.enabled = true;
            IN_GAME_MAIN_CAMERA.SpecMov.disable    = true;
            IN_GAME_MAIN_CAMERA.Look.disable       = true;
            IN_GAME_MAIN_CAMERA.GameMode           = Level.Mode;
            SpawnPlayer(IN_GAME_MAIN_CAMERA.singleCharacter.ToUpper());
            Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
            Screen.showCursor = false;
            var rate = 90;
            if (difficulty == 1)
            {
                rate = 70;
            }

            SpawnTitansCustom(rate, info.EnemyNumber);
            return;
        }

        PVPcheckPoint.chkPts = new ArrayList();
        IN_GAME_MAIN_CAMERA.MainCamera.enabled = false;
        IN_GAME_MAIN_CAMERA.BaseCamera.GetComponent <CameraShake>().enabled = false;
        IN_GAME_MAIN_CAMERA.GameType = GameType.MultiPlayer;
        LoadSkinCheck();
        CustomLevel.OnLoadLevel();
        switch (info.Mode)
        {
        case GameMode.Trost:
        {
            CacheGameObject.Find("playerRespawn").SetActive(false);
            Destroy(CacheGameObject.Find("playerRespawn"));
            var gameObject3 = CacheGameObject.Find("rock");
            gameObject3.animation["lift"].speed = 0f;
            CacheGameObject.Find("door_fine").SetActive(false);
            CacheGameObject.Find("door_broke").SetActive(true);
            Destroy(CacheGameObject.Find("ppl"));
            break;
        }

        case GameMode.BossFightCT:
            CacheGameObject.Find("playerRespawnTrost").SetActive(false);
            Destroy(CacheGameObject.Find("playerRespawnTrost"));
            break;
        }

        if (needChooseSide)
        {
            ShowHUDInfoTopCenterADD("\n\nPRESS 1 TO ENTER GAME");
        }
        else
        {
            Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS;
            if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE)
            {
                if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2)
                {
                    checkpoint = CacheGameObject.Find("PVPchkPtT");
                }
                else
                {
                    checkpoint = CacheGameObject.Find("PVPchkPtH");
                }
            }

            if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2)
            {
                SpawnNonAiTitan(myLastHero);
            }
            else
            {
                SpawnPlayer(myLastHero);
            }
        }

        if (info.Mode == GameMode.BossFightCT)
        {
            Destroy(CacheGameObject.Find("rock"));
        }

        if (PhotonNetwork.IsMasterClient)
        {
            switch (info.Mode)
            {
            case GameMode.Trost:
            {
                if (!IsPlayerAllDead())
                {
                    var gameObject4 = Pool.NetworkEnable("TITAN_EREN_trost", new Vector3(-200f, 0f, -194f),
                                                         Quaternion.Euler(0f, 180f, 0f));
                    gameObject4.GetComponent <TITAN_EREN>().rockLift = true;
                    var rate2 = 90;
                    if (difficulty == 1)
                    {
                        rate2 = 70;
                    }

                    var array3      = GameObject.FindGameObjectsWithTag("titanRespawn");
                    var gameObject5 = CacheGameObject.Find("titanRespawnTrost");
                    if (gameObject5 != null)
                    {
                        foreach (var gameObject6 in array3)
                        {
                            if (gameObject6.transform.parent.gameObject == gameObject5)
                            {
                                SpawnTitan(rate2, gameObject6.transform.position, gameObject6.transform.rotation);
                            }
                        }
                    }
                }

                break;
            }

            case GameMode.BossFightCT:
            {
                if (!IsPlayerAllDead())
                {
                    Pool.NetworkEnable("COLOSSAL_TITAN", -Vectors.up * 10000f, Quaternion.Euler(0f, 180f, 0f));
                }

                break;
            }

            case GameMode.KillTitan:
            case GameMode.EndlessTitan:
            case GameMode.SurviveMode:
            {
                if (info.Name == "Annie" || info.Name == "Annie II")
                {
                    Pool.NetworkEnable("FEMALE_TITAN", CacheGameObject.Find("titanRespawn").transform.position,
                                       CacheGameObject.Find("titanRespawn").transform.rotation);
                }
                else
                {
                    var rate3 = 90;
                    if (difficulty == 1)
                    {
                        rate3 = 70;
                    }

                    SpawnTitansCustom(rate3, info.EnemyNumber);
                }

                break;
            }

            default:
            {
                if (info.Mode != GameMode.Trost)
                {
                    if (info.Mode == GameMode.PVP_CAPTURE && Level.MapName == "OutSide")
                    {
                        var array5 = GameObject.FindGameObjectsWithTag("titanRespawn");
                        if (array5.Length <= 0)
                        {
                            return;
                        }

                        for (var k = 0; k < array5.Length; k++)
                        {
                            SpawnTitanRaw(array5[k].transform.position, array5[k].transform.rotation)
                            .SetAbnormalType(AbnormalType.Crawler, true);
                        }
                    }
                }

                break;
            }
            }
        }

        if (!info.Supply)
        {
            Destroy(CacheGameObject.Find("aot_supply"));
        }

        if (!PhotonNetwork.IsMasterClient)
        {
            BasePV.RPC("RequireStatus", PhotonTargets.MasterClient);
        }

        if (Stylish != null)
        {
            Stylish.enabled = true;
        }

        if (Level.LavaMode)
        {
            Instantiate(CacheResources.Load("levelBottom"), new Vector3(0f, -29.5f, 0f), Quaternion.Euler(0f, 0f, 0f));
            CacheGameObject.Find("aot_supply").transform.position =
                CacheGameObject.Find("aot_supply_lava_position").transform.position;
            CacheGameObject.Find("aot_supply").transform.rotation =
                CacheGameObject.Find("aot_supply_lava_position").transform.rotation;
        }

        if (GameModes.BombMode.Enabled)
        {
            if (Level.Name.StartsWith("The Forest"))
            {
                // Added the creation of an empty gameobject with MapCeilingObject as a component - Thyme 02/28/21
                GameObject mapCeiling = new GameObject("MapCeilingPrefab");
                mapCeiling.AddComponent <TLW.MapCeiling>();
                mapCeiling.transform.position   = new Vector3(0f, 280f, 0f);
                mapCeiling.transform.rotation   = Quaternion.identity;
                mapCeiling.transform.localScale = new Vector3(1320f, 20f, 1320f);
            }
            else if (Level.Name.StartsWith("The City"))
            {
                GameObject mapCeiling = new GameObject("MapCeilingPrefab");
                mapCeiling.AddComponent <TLW.MapCeiling>();
                mapCeiling.transform.position   = new Vector3(0f, 210f, 0f);
                mapCeiling.transform.rotation   = Quaternion.identity;
                mapCeiling.transform.localScale = new Vector3(1400f, 20f, 1400f);
            }
        }

        roomInformation.UpdateLabels();
        Resources.UnloadUnusedAssets();
    }