Exemple #1
0
    public void Fall(HumanBase humanBase, bool drown = false)
    {
        Human human = humanBase as Human;

        if (ReplayRecorder.isPlaying || NetGame.isClient)
        {
            return;
        }
        if (passedLevel && ((currentLevelNumber >= 0 && currentLevelNumber < levels.Length) || workshopLevel != null || currentLevelType == WorkshopItemSource.EditorPick))
        {
            if (ReplayRecorder.isRecording)
            {
                ReplayRecorder.Stop();
            }
            else if (workshopLevel != null)
            {
                passedLevel = false;
                PlayerManager.SetSingle();
                App.instance.PauseLeave();
                GameSave.PassCheckpointWorkshop(workshopLevel.hash, 0);
            }
            else if (currentLevelType == WorkshopItemSource.EditorPick)
            {
                passedLevel = false;
                PlayerManager.SetSingle();
                App.instance.PauseLeave();
                if (NetGame.isLocal)
                {
                    GameSave.StartFromBeginning();
                }
                for (int i = 0; i < Human.all.Count; i++)
                {
                    Human.all[i].ReleaseGrab();
                }
            }
            else
            {
                StatsAndAchievements.PassLevel(levels[currentLevelNumber], human);
                for (int j = 0; j < Human.all.Count; j++)
                {
                    Human.all[j].ReleaseGrab();
                }
                StartCoroutine(PassLevel());
            }
        }
        else
        {
            if (drown)
            {
                StatsAndAchievements.IncreaseDrownCount(human);
            }
            else
            {
                StatsAndAchievements.IncreaseFallCount(human);
            }
            Respawn(human, Vector3.zero);
            CheckpointRespawned(currentCheckpointNumber);
        }
    }