private void Update()
 {
     if (!DifficultySettings.ActivePreset.m_Tribes)
     {
         return;
     }
     if (ScenarioManager.Get().IsDreamOrPreDream())
     {
         return;
     }
     if (DifficultySettings.ActivePreset.m_Tribes)
     {
         this.UpdateCampGroups();
     }
     if (this.m_ScenarioBlock)
     {
         return;
     }
     if (this.m_ActiveGroup && this.m_ActiveGroup.IsWave())
     {
         FirecampGroupsManager.Get().ResetBurningFactors();
     }
     if (DifficultySettings.ActivePreset.m_Tribes)
     {
         this.UpdateGroupMembersCount();
         this.UpdateGroups(this.m_PatrolGroups);
         this.UpdateGroups(this.m_Groups);
         this.UpdateWaves();
     }
     if (DifficultySettings.ActivePreset.m_Predators)
     {
         this.UpdatePredators();
     }
 }
Exemplo n.º 2
0
 protected override void Awake()
 {
     base.Awake();
     this.m_Animator = base.gameObject.GetComponent <Animator>();
     this.m_BloodTrigger.SetOwner(this);
     this.m_ItemSlot.gameObject.SetActive(false);
     this.m_ItemSlot.m_ActivityUpdate = false;
     this.m_CureSlot.gameObject.SetActive(false);
     this.m_CureSlot.m_ActivityUpdate = false;
     this.m_AudioSource = new GameObject("audio")
     {
         transform =
         {
             parent   = base.transform,
             position = Vector3.zero
         }
     }.AddComponent <AudioSource>();
     this.m_AudioSource.outputAudioMixerGroup = GreenHellGame.Instance.GetAudioMixerGroup(AudioMixerGroupGame.AI);
     this.m_AudioSource.spatialBlend          = 1f;
     this.m_AudioSource.rolloffMode           = AudioRolloffMode.Linear;
     this.m_AudioSource.minDistance           = 2f;
     this.m_AudioSource.maxDistance           = 30f;
     this.m_AudioSource.spatialize            = true;
     this.m_AudioSource.loop = true;
     this.m_AudioSource.clip = Resources.Load <AudioClip>("Sounds/Story/kjurmachine_sfx_processing_result_succes_loop");
     ScenarioManager.Get().CreateIntVariable("CureMachineState", (int)this.m_State);
 }
Exemplo n.º 3
0
 public void UpdateWTActivity()
 {
     if (!this.IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !ScenarioManager.Get().IsDreamOrPreDream() && this.m_WalkieTalkieObject && this.m_WalkieTalkieObject.activeSelf)
     {
         this.m_WalkieTalkieObject.SetActive(false);
     }
 }
Exemplo n.º 4
0
    public override void ConstantUpdate()
    {
        if (ScenarioManager.Get().IsDreamOrPreDream())
        {
            return;
        }
        int i = 0;

        while (i < this.m_AIs.Count)
        {
            if (this.m_AIs[i] == null)
            {
                this.m_AIs.RemoveAt(i);
            }
            else
            {
                if (!this.m_AIs[i].gameObject.activeSelf && base.gameObject.activeSelf)
                {
                    this.m_AIs[i].gameObject.SetActive(true);
                }
                i++;
            }
        }
        this.TryCatch();
    }
Exemplo n.º 5
0
 public static void SetupObjects()
 {
     SaveGame.m_Objects.Clear();
     SaveGame.m_Objects.Add(DifficultySettings.Get());
     SaveGame.m_Objects.Add(DialogsManager.Get());
     SaveGame.m_Objects.Add(AIManager.Get());
     SaveGame.m_Objects.Add(EnemyAISpawnManager.Get());
     SaveGame.m_Objects.Add(TriggersManager.Get());
     SaveGame.m_Objects.Add(ItemsManager.Get());
     SaveGame.m_Objects.Add(SensorManager.Get());
     SaveGame.m_Objects.Add(ConstructionGhostManager.Get());
     SaveGame.m_Objects.Add(StaticObjectsManager.Get());
     SaveGame.m_Objects.Add(Player.Get());
     SaveGame.m_Objects.Add(PlayerConditionModule.Get());
     SaveGame.m_Objects.Add(PlayerInjuryModule.Get());
     SaveGame.m_Objects.Add(PlayerDiseasesModule.Get());
     SaveGame.m_Objects.Add(StatsManager.Get());
     SaveGame.m_Objects.Add(HintsManager.Get());
     SaveGame.m_Objects.Add(ObjectivesManager.Get());
     SaveGame.m_Objects.Add(StoryObjectivesManager.Get());
     SaveGame.m_Objects.Add(HUDObjectives.Get());
     SaveGame.m_Objects.Add(MenuNotepad.Get());
     SaveGame.m_Objects.Add(MapTab.Get());
     SaveGame.m_Objects.Add(Music.Get());
     SaveGame.m_Objects.Add(RainManager.Get());
     SaveGame.m_Objects.Add(SleepController.Get());
     SaveGame.m_Objects.Add(MainLevel.Instance);
     SaveGame.m_Objects.Add(ScenarioManager.Get());
     SaveGame.m_Objects.Add(InventoryBackpack.Get());
     SaveGame.m_Objects.Add(ReplicatedSessionState.Get());
 }
Exemplo n.º 6
0
        private void UpdateActivity(bool force = false)
        {
            if (ScenarioManager.Get().IsDreamOrPreDream() || ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"))
            {
                foreach (AI ai in this.m_AllAIs)
                {
                    if (ai.gameObject.activeSelf && !ai.IsKidRunner())
                    {
                        ai.gameObject.SetActive(false);
                    }
                }
                return;
            }
            if (!force && Time.time - this.m_LastUpdateActivity < this.m_UpdateActivityInterval)
            {
                return;
            }
            Vector3 position = Player.Get().transform.position;

            foreach (AI ai2 in this.m_AllAnimalAIs)
            {
                if (!ai2.m_Trap && ai2.CheckActivityByDistance())
                {
                    float num = Vector3.Distance(position, ai2.transform.position);
                    if (ai2.m_BleedingDamage == 0f)
                    {
                        if (num > this.m_AIActivationRange)
                        {
                            UnityEngine.Object.Destroy(ai2.gameObject);
                        }
                    }
                    else if (num > this.m_AIBleedingActivationRange)
                    {
                        UnityEngine.Object.Destroy(ai2.gameObject);
                    }
                }
            }
            foreach (DeadBody deadBody in this.m_DeadBodies)
            {
                float num2 = Vector3.Distance(position, deadBody.transform.position);
                if (deadBody.gameObject.activeSelf)
                {
                    if (num2 > this.m_AIActivationRange)
                    {
                        deadBody.gameObject.SetActive(false);
                        deadBody.m_DeactivationTime = Time.time;
                    }
                }
                else if (Time.time - deadBody.m_DeactivationTime > 60f)
                {
                    UnityEngine.Object.Destroy(deadBody.gameObject);
                }
                else if (num2 <= this.m_AIActivationRange * 0.75f)
                {
                    deadBody.gameObject.SetActive(true);
                }
            }
            this.m_LastUpdateActivity = Time.time;
        }
Exemplo n.º 7
0
 public void OnSurvival()
 {
     ScenarioManager.Get().m_SkipTutorial = true;
     MainLevel.Instance.m_GameMode     = GameMode.Survival;
     GreenHellGame.Instance.m_GameMode = GameMode.Survival;
     MainLevel.Instance.Initialize();
     MenuInGameManager.Get().HideMenu();
     this.StartRainforestAmbienceMultisample();
 }
Exemplo n.º 8
0
 public static void UpdateFullLoadWaitingForScenario()
 {
     if (ScenarioManager.Get().LoadingCompleted())
     {
         GreenHellGame.Instance.m_LoadGameState = LoadGameState.FullLoadCompleted;
         SaveGame.m_State = SaveGame.State.None;
         MainLevel.Instance.OnFullLoadEnd();
     }
 }
Exemplo n.º 9
0
 public void OnChallenge(string name)
 {
     ChallengesManager.Get().m_ChallengeToActivate = name;
     ScenarioManager.Get().m_SkipTutorial          = true;
     MainLevel.Instance.m_GameMode     = GameMode.Survival;
     GreenHellGame.Instance.m_GameMode = GameMode.Survival;
     MainLevel.Instance.Initialize();
     MenuInGameManager.Get().HideMenu();
     this.StartRainforestAmbienceMultisample();
 }
Exemplo n.º 10
0
 private void SetState(CureMachine.State state)
 {
     if (this.m_State == state)
     {
         return;
     }
     this.m_State = state;
     this.OnEnterState();
     ScenarioManager.Get().SetIntVariable("CureMachineState", (int)state);
 }
Exemplo n.º 11
0
 public void OnDream(string variable)
 {
     ScenarioManager.Get().m_SkipTutorial = true;
     MainLevel.Instance.m_GameMode     = GameMode.Story;
     GreenHellGame.Instance.m_GameMode = GameMode.Story;
     MainLevel.Instance.Initialize();
     MenuInGameManager.Get().HideMenu();
     this.StartRainforestAmbienceMultisample();
     ScenarioManager.Get().SetBoolVariable(variable, true);
 }
Exemplo n.º 12
0
 public void Load()
 {
     ScenarioManager.Get().ResetVariables();
     this.m_ActionObjectsToLoad.Clear();
     this.m_ActionComponentToLoad.Clear();
     foreach (ScenarioNode scenarioNode in this.m_Nodes)
     {
         scenarioNode.Reset();
     }
     this.m_IsLoading = true;
     foreach (ScenarioNode scenarioNode2 in this.m_Nodes)
     {
         scenarioNode2.Load();
         if (scenarioNode2.m_State == ScenarioNode.State.None && scenarioNode2.m_Parents.Count == 0)
         {
             scenarioNode2.Activate();
         }
     }
     foreach (GameObject gameObject in this.m_ActionObjectsToLoad)
     {
         if (gameObject)
         {
             gameObject.SetActive(SaveGame.LoadBVal("AO" + gameObject.name));
         }
     }
     foreach (GameObject gameObject2 in this.m_ActionComponentToLoad.Keys)
     {
         if (gameObject2)
         {
             if (this.m_ActionComponentToLoad[gameObject2].Contains("Collider"))
             {
                 (gameObject2.GetComponent(this.m_ActionComponentToLoad[gameObject2]) as Collider).enabled = SaveGame.LoadBVal("AOC" + gameObject2.name);
             }
             else
             {
                 (gameObject2.GetComponent(this.m_ActionComponentToLoad[gameObject2]) as Behaviour).enabled = SaveGame.LoadBVal("AOC" + gameObject2.name);
             }
         }
     }
     foreach (ScenarioNode scenarioNode3 in this.m_Nodes)
     {
         if (scenarioNode3.m_State != ScenarioNode.State.Inactive && scenarioNode3.m_State != ScenarioNode.State.None)
         {
             foreach (ScenarioElement scenarioElement in scenarioNode3.m_Elements)
             {
                 scenarioElement.PostLoad();
             }
         }
     }
     this.LoadBoolvariables();
     this.LoadIntVariables();
     MainLevel.Instance.LoadDayTime();
     this.m_IsLoading = false;
 }
Exemplo n.º 13
0
    private void SaveIntVariables()
    {
        Dictionary <string, int> intVariables = ScenarioManager.Get().m_IntVariables;

        SaveGame.SaveVal("IntVariablesCount", intVariables.Count);
        for (int i = 0; i < intVariables.Count; i++)
        {
            SaveGame.SaveVal("IntVariableName" + i, intVariables.ElementAt(i).Key);
            SaveGame.SaveVal("IntVariable" + i, intVariables.ElementAt(i).Value);
        }
    }
Exemplo n.º 14
0
    private void LoadIntVariables()
    {
        int num = SaveGame.LoadIVal("IntVariablesCount");

        for (int i = 0; i < num; i++)
        {
            string name = SaveGame.LoadSVal("IntVariableName" + i);
            int    val  = SaveGame.LoadIVal("IntVariable" + i);
            ScenarioManager.Get().SetIntVariable(name, val);
        }
    }
Exemplo n.º 15
0
    public override void LateUpdate()
    {
        if (Debug.isDebugBuild)
        {
            this.UpdateDebug();
        }
        base.LateUpdate();
        bool flag = ScenarioManager.Get().IsDream();

        if (flag && !this.m_WasDreamActive)
        {
            this.SetMeshesVisible(false);
        }
        else if (!flag && this.m_WasDreamActive)
        {
            this.SetMeshesVisible(true);
        }
        this.m_WasDreamActive = flag;
        if ((this.m_ScheduleTakeDamage && (this.m_ArmorTakeDamagePhaseCompleted & 2) != 0 && (this.m_ArmorTakeDamagePhaseCompleted & 1) != 0) || (Debug.isDebugBuild && Input.GetKey(KeyCode.RightAlt) && Input.GetKey(KeyCode.P)))
        {
            if (this.m_DamageLimb == Limb.None)
            {
                this.m_DamageLimb   = Limb.LArm;
                this.m_DamageToTake = 100f;
            }
            ArmorData armorData = this.m_LimbMap[(int)this.m_DamageLimb];
            if (armorData != null)
            {
                DamageInfo damageInfo = new DamageInfo();
                damageInfo.m_Damage = this.m_DamageToTake;
                armorData.m_AttachedArmor.TakeDamage(damageInfo);
                if (armorData.m_AttachedArmor.m_Info.m_Health <= 0f)
                {
                    this.OnArmorDestroyed(armorData);
                }
            }
            this.m_ScheduleTakeDamage            = false;
            this.m_ArmorTakeDamagePhaseCompleted = 0;
            this.m_DamageLimb = Limb.None;
        }
        Dictionary <int, ArmorData> .Enumerator enumerator = this.m_LimbMap.GetEnumerator();
        while (enumerator.MoveNext())
        {
            KeyValuePair <int, ArmorData> keyValuePair = enumerator.Current;
            ArmorData value = keyValuePair.Value;
            if (value.m_Destroyed && value.m_AttachedArmor)
            {
                value.m_AttachedArmor.transform.localRotation = Quaternion.identity;
                value.m_AttachedArmor.transform.localPosition = Vector3.zero;
            }
        }
        enumerator.Dispose();
    }
    private void UpdateActivity()
    {
        if (this.m_AllGhosts.Count == 0)
        {
            return;
        }
        if (Time.time - this.m_LastUpdateActivityTime < this.m_UpdateActivityInterval)
        {
            return;
        }
        float num  = (float)Mathf.Min(20, this.m_AllGhosts.Count);
        int   num2 = 0;

        while ((float)num2 < num)
        {
            if (this.m_CurrentIndex >= this.m_AllGhosts.Count)
            {
                this.m_CurrentIndex = 0;
            }
            ConstructionGhost constructionGhost = this.m_AllGhosts[this.m_CurrentIndex];
            if (constructionGhost.m_Challenge)
            {
                this.m_CurrentIndex++;
            }
            else if (ScenarioManager.Get().IsPreDream())
            {
                if (constructionGhost.gameObject.activeSelf)
                {
                    constructionGhost.gameObject.SetActive(false);
                }
                this.m_CurrentIndex++;
            }
            else if (constructionGhost.m_ResultItemID == ItemID.Bamboo_Bridge && GreenHellGame.Instance.m_GameMode == GameMode.Story)
            {
                if (constructionGhost.gameObject.activeSelf)
                {
                    constructionGhost.gameObject.SetActive(false);
                }
                this.m_CurrentIndex++;
            }
            else
            {
                bool flag = Player.Get().transform.position.Distance(constructionGhost.transform.position) < this.m_ActivityDist;
                if (constructionGhost.gameObject.activeSelf != flag && !constructionGhost.IsReady())
                {
                    constructionGhost.gameObject.SetActive(flag);
                }
                this.m_CurrentIndex++;
            }
            num2++;
        }
        this.m_LastUpdateActivityTime = Time.time;
    }
Exemplo n.º 17
0
    public void UpdateActivity()
    {
        if (this.m_IsBeingDestroyed)
        {
            return;
        }
        if (!this.m_ActivityUpdate)
        {
            return;
        }
        if (this.m_NextUpdateActivityTime > Time.time)
        {
            return;
        }
        if (this.m_ShowOnlyIfItemIsCorrect && !this.CanInsertItem(Inventory3DManager.Get().m_CarriedItem))
        {
            this.Deactivate();
            this.m_NextUpdateActivityTime = Time.time;
            return;
        }
        if (ScenarioManager.Get().IsDreamOrPreDream())
        {
            this.Deactivate();
            this.m_NextUpdateActivityTime = Time.time;
            return;
        }
        if (this.m_BackpackSlot || (this.m_ItemParent && this.m_ItemParent.gameObject.activeInHierarchy && this.m_ItemParent.m_InInventory))
        {
            if (InventoryBackpack.Get().gameObject.activeSelf&& (!this.m_ItemParent || !this.m_ItemParent.m_OnCraftingTable))
            {
                this.Activate();
            }
            else
            {
                this.Deactivate();
            }
            this.m_NextUpdateActivityTime = Time.time;
            return;
        }
        float num = Vector3.Distance(Player.Get().transform.position, this.GetCheckPosition());

        if (num <= ItemSlot.s_DistToActivate)
        {
            this.Activate();
        }
        else
        {
            this.Deactivate();
        }
        this.m_NextUpdateActivityTime = Time.time + CJTools.Math.GetProportionalClamp(0.1f, 5f, num, 5f, 50f);
    }
Exemplo n.º 18
0
    private void SaveBoolVariables()
    {
        Dictionary <int, bool>   boolVariables = ScenarioManager.Get().m_BoolVariables;
        Dictionary <int, string> hashNames     = ScenarioManager.Get().m_HashNames;

        SaveGame.SaveVal("BoolVariablesCount", boolVariables.Count);
        for (int i = 0; i < boolVariables.Count; i++)
        {
            int    key = boolVariables.ElementAt(i).Key;
            string val = hashNames[key];
            SaveGame.SaveVal("BoolVariableName" + i, val);
            SaveGame.SaveVal("BoolVariable" + i, boolVariables.ElementAt(i).Value);
        }
    }
Exemplo n.º 19
0
    protected override bool ShouldShow()
    {
        if (GreenHellGame.Instance.m_GameMode != GameMode.Story)
        {
            return(false);
        }
        if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"))
        {
            return(false);
        }
        if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive())
        {
            return(false);
        }
        if (ConsciousnessController.Get().IsActive())
        {
            return(false);
        }
        if (SleepController.Get().IsActive())
        {
            return(false);
        }
        if (HUDReadableItem.Get().enabled)
        {
            return(false);
        }
        if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash))
        {
            return(false);
        }
        if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f)
        {
            return(false);
        }
        if (Player.Get().m_IsInAir)
        {
            return(false);
        }
        if (HUDWheel.Get().enabled)
        {
            return(false);
        }
        if (FPPController.Get().m_Dodge)
        {
            return(false);
        }
        int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash;

        return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash && (!DeathController.Get().IsActive() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !SwimController.Get().IsActive() && !BodyInspectionController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !VomitingController.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !MudMixerController.Get().IsActive()) && !MakeFireController.Get().IsActive());
    }
Exemplo n.º 20
0
 protected override bool ShouldShow()
 {
     if (Player.Get().m_DreamActive)
     {
         this.ShiftStartTime();
         return(false);
     }
     if (ScenarioManager.Get().IsDreamOrPreDream())
     {
         this.ShiftStartTime();
         return(false);
     }
     return(this.m_Messages.Count > 0);
 }
Exemplo n.º 21
0
 private void UpdateDuck()
 {
     if (ScenarioManager.Get().IsDream())
     {
         this.m_Animator.SetBool(this.m_BDuck, false);
         return;
     }
     if (base.GetComponent <WeaponController>().IsActive() && base.GetComponent <WeaponController>().DuckDuringAttack())
     {
         this.m_Animator.SetBool(this.m_BDuck, true);
         return;
     }
     this.m_Duck = this.m_Inputs.m_Duck;
     this.m_Animator.SetBool(this.m_BDuck, false);
 }
Exemplo n.º 22
0
    protected override void OnShow()
    {
        base.OnShow();
        this.m_ShowTime = Time.time;
        Color color = this.m_BG.color;

        color.a           = 0f;
        this.m_BG.color   = color;
        color             = this.m_Logo.color;
        color.a           = 0f;
        this.m_Logo.color = color;
        Player.Get().BlockMoves();
        Player.Get().BlockRotation();
        ScenarioManager.Get().SetBoolVariable("PlayerMechGameEnding", true);
    }
Exemplo n.º 23
0
    public override void Setup()
    {
        base.Setup();
        this.m_PerformOnLoad = this.m_ScenarioSyntaxData.m_PerformOnLoad;
        string[] array = this.m_EncodedContent.Split(new char[]
        {
            ':'
        });
        if (array.Length != 4)
        {
            DebugUtils.Assert(string.Concat(new string[]
            {
                "[ScenarioSetParam:Setup] Error in element - ",
                this.m_Content,
                ", node - ",
                this.m_Node.m_Name,
                ". Check spelling!"
            }), true, DebugUtils.AssertType.Info);
        }
        string text = array[1];
        Type   type = Type.GetType(text);

        this.m_Object = ScenarioManager.Get().GetObjectOfType(type);
        DebugUtils.Assert(this.m_Object != null, "[ScenarioSetParam:Setup] ERROR - Can't find object " + text, true, DebugUtils.AssertType.Info);
        this.m_Property = type.GetProperty("m_" + array[2]);
        if (this.m_Property.PropertyType == typeof(string))
        {
            this.m_Var.SValue = array[3];
            return;
        }
        if (this.m_Property.PropertyType == typeof(float))
        {
            this.m_Var.FValue = float.Parse(array[3]);
            return;
        }
        if (this.m_Property.PropertyType == typeof(bool))
        {
            this.m_Var.BValue = bool.Parse(array[3]);
            return;
        }
        if (this.m_Property.PropertyType == typeof(int))
        {
            this.m_Var.IValue = int.Parse(array[3]);
        }
    }
Exemplo n.º 24
0
 public bool Activate(LiquidSource source)
 {
     if (this.m_Active)
     {
         return(false);
     }
     this.ResetItems();
     this.m_LiquidSource = source;
     this.ClearSlots();
     this.AddSlot(HUDItem.Action.Drink);
     this.AddSlot(HUDItem.Action.CleanUp);
     if (!ScenarioManager.Get().IsDreamOrPreDream())
     {
         this.AddSlot(HUDItem.Action.TakeClay);
     }
     this.Activate();
     return(true);
 }
Exemplo n.º 25
0
 protected override void OnDisable()
 {
     base.OnDisable();
     this.m_Animator.CrossFade(this.m_Idle, 0.2f, 0);
     this.m_Animator.CrossFade(this.m_UnarmedIdle, 0.2f, 1);
     if (this.m_Trigger && Player.Get())
     {
         Collider[] componentsInChildren = this.m_Trigger.GetComponentsInChildren <Collider>();
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             Physics.IgnoreCollision(componentsInChildren[i], Player.Get().m_Collider, false);
         }
     }
     if (this.m_State == AnimationTriggerController.State.Animation && this.m_Trigger)
     {
         ScenarioManager.Get().SetBoolVariable(this.m_Trigger.m_ScenarioBoolVariable, true);
     }
     LookController.Get().m_LookDev.y = 0f;
     LookController.Get().m_WantedLookDev.y = 0f;
     base.ResetBodyRotationBonesParams();
     FPPController.Get().ResetBodyRotationBonesParams();
 }
Exemplo n.º 26
0
    public void UnlockScenarioDialog(string name)
    {
        Dialog dialog = this.m_Dialogs[name];

        if (!this.m_ScenarioDialogs.ContainsKey(dialog.m_Group))
        {
            this.m_ScenarioDialogs.Add(dialog.m_Group, new List <Dialog>());
        }
        this.m_ScenarioDialogs[dialog.m_Group].Add(dialog);
        if (HUDManager.Get() == null)
        {
            Debug.Log("DialogsManager UnlockScenarioDialog no HUDManager");
            return;
        }
        if (SaveGame.m_State == SaveGame.State.None)
        {
            ((HUDInfoLog)HUDManager.Get().GetHUD(typeof(HUDInfoLog))).AddInfo(GreenHellGame.Instance.GetLocalization().Get("HUD_InfoLog_NewDialog", true), string.Empty, HUDInfoLogTextureType.WT);
            if (!ScenarioManager.Get().IsDreamOrPreDream())
            {
                PlayerAudioModule.Get().PlayNotepadEntrySound();
            }
            HUDWalkieTalkie.Get().UpdateNewDialogsCounter();
        }
    }
Exemplo n.º 27
0
 private bool CanAttack()
 {
     return(!FightController.s_BlockFight && !MainLevel.Instance.IsPause() && Time.time - MainLevel.Instance.m_LastUnpauseTime >= 0.25f && !this.m_Player.IsDead() && !SwimController.Get().IsActive() && !HUDWheel.Get().enabled&& !BodyInspectionController.Get().IsActive() && !WatchController.Get().IsActive() && !NotepadController.Get().IsActive() && !MapController.Get().IsActive() && this.m_ActionAllowed && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && this.m_CurrentParam != 6 && this.m_CurrentParam != 8 && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding") && !HUDSelectDialog.Get().enabled);
 }
Exemplo n.º 28
0
    private void OnEnterState()
    {
        switch (this.m_State)
        {
        case CureMachine.State.WaitingForBlood:
            this.m_Animator.CrossFadeInFixedTime(this.m_LClapOpenIdleHash, 0f, 0);
            this.m_Animator.CrossFadeInFixedTime(this.m_LClapOpenIdleHash, 0f, 1);
            this.m_BloodTrigger.gameObject.SetActive(true);
            this.m_BloodTrigger.enabled = true;
            this.m_ItemSlot.gameObject.SetActive(false);
            return;

        case CureMachine.State.BloodInserted:
            this.m_Animator.SetTrigger(this.m_LClapCloseHash);
            this.m_BloodTrigger.enabled = false;
            ScenarioManager.Get().SetBoolVariable("UsedBloodInAnalizer", true);
            for (int i = 0; i < this.m_BloodTrigger.m_RequiredItems.Count; i++)
            {
                Item item = InventoryBackpack.Get().FindItem(this.m_BloodTrigger.m_RequiredItems[i]);
                if (item)
                {
                    UnityEngine.Object.Destroy(item.gameObject);
                }
            }
            return;

        case CureMachine.State.WaitingForItem:
            this.m_ItemSlot.gameObject.SetActive(true);
            this.m_ItemSlot.Activate();
            return;

        case CureMachine.State.Processing:
            this.m_Animator.SetTrigger(this.m_RClapCloseHash);
            this.m_ItemSlot.gameObject.SetActive(false);
            return;

        case CureMachine.State.Fail:
            if (this.m_ItemSlot.m_Item)
            {
                UnityEngine.Object.Destroy(this.m_ItemSlot.m_Item.gameObject);
            }
            this.m_Animator.SetTrigger(this.m_FailHash);
            return;

        case CureMachine.State.Success:
        {
            if (this.m_ItemSlot.m_Item)
            {
                UnityEngine.Object.Destroy(this.m_ItemSlot.m_Item.gameObject);
            }
            this.m_Animator.SetTrigger(this.m_SuccessHash);
            this.m_BloodTrigger.gameObject.SetActive(false);
            Item item2 = ItemsManager.Get().CreateItem(this.m_ResultItemID, true, this.m_CureSlot.transform);
            this.m_CureSlot.InsertItem(item2);
            this.m_CureSlot.gameObject.SetActive(true);
            this.m_AudioSource.Play();
            return;
        }

        default:
            return;
        }
    }
Exemplo n.º 29
0
 public void Initialize()
 {
     this.m_AllObjects.Clear();
     UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject));
     foreach (GameObject gameObject in array)
     {
         if (gameObject.scene.IsValid())
         {
             this.m_AllObjects.Add(gameObject);
             if (!this.m_UniqueObjects.ContainsKey(gameObject.name))
             {
                 this.m_UniqueObjects.Add(gameObject.name, gameObject);
             }
         }
     }
     if (this.m_AnimalSoundsAudioSource == null)
     {
         this.m_AnimalSoundsAudioSource = base.gameObject.AddComponent <AudioSource>();
         this.m_AnimalSoundsAudioSource.outputAudioMixerGroup = GreenHellGame.Instance.GetAudioMixerGroup(AudioMixerGroupGame.Enviro);
         this.m_AnimalSounds.Clear();
         List <AudioClip> value  = new List <AudioClip>();
         List <AudioClip> value2 = new List <AudioClip>();
         this.m_AnimalSounds.Add(true, value2);
         this.m_AnimalSounds.Add(false, value);
         for (int j = 1; j < 24; j++)
         {
             string text = MainLevel.s_AnimalSoundsDayName;
             if (j < 10)
             {
                 text += "0";
             }
             text += j.ToString();
             AudioClip item = Resources.Load(MSSample.s_SamplesPath + text) as AudioClip;
             this.m_AnimalSounds[true].Add(item);
         }
         for (int k = 1; k < 22; k++)
         {
             string text2 = MainLevel.s_AnimalSoundsNightName;
             if (k < 10)
             {
                 text2 += "0";
             }
             text2 += k.ToString();
             AudioClip item2 = Resources.Load(MSSample.s_SamplesPath + text2) as AudioClip;
             this.m_AnimalSounds[false].Add(item2);
         }
     }
     this.TeleportPlayerOnStart();
     HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Game);
     ChallengesManager.Get().OnLevelLoaded();
     ScenarioManager.Get().Initialize();
     if (GreenHellGame.Instance.m_FromSave)
     {
         SaveGame.Load();
     }
     if (GreenHellGame.ROADSHOW_DEMO)
     {
         Cheats.m_GodMode = true;
     }
     this.m_FogStartDistance      = RenderSettings.fogStartDistance;
     this.m_FogEndDistance        = RenderSettings.fogEndDistance;
     this.m_EmmisiveColorProperty = Shader.PropertyToID("_EmissionColor");
     this.m_EmissiveColor         = new Color(0.29f, 0.611f, 0.219f, 1f);
     if (GreenHellGame.TWITCH_DEMO)
     {
         new TwitchDemoManager();
     }
     this.m_PostProcessLayer          = Camera.main.GetComponent <PostProcessLayer>();
     this.m_DefaultStationaryBlending = this.m_PostProcessLayer.temporalAntialiasing.stationaryBlending;
     CursorManager.Get().ResetCursorRequests();
     CursorManager.Get().ShowCursor(false);
     CursorManager.Get().SetCursor(CursorManager.TYPE.Normal);
     this.m_NGSSDirectional = this.m_TODSky.gameObject.GetComponentInChildren <NGSS_Directional>();
     this.m_GrassManager    = Terrain.activeTerrain.GetComponent <GrassManager>();
 }
Exemplo n.º 30
0
    public override void Setup()
    {
        base.Setup();
        this.m_PerformOnLoad = this.m_ScenarioSyntaxData.m_PerformOnLoad;
        string[] array = this.m_EncodedContent.Split(new char[]
        {
            ':'
        });
        if (array.Length < 3 || array.Length > 8)
        {
            DebugUtils.Assert(string.Concat(new string[]
            {
                "[ScenarioAction:Setup] Error in element - ",
                this.m_Content,
                ", node - ",
                this.m_Node.m_Name,
                ". Check spelling!"
            }), true, DebugUtils.AssertType.Info);
        }
        string text = array[1];
        Type   type = Type.GetType(text);

        UnityEngine.Object objectOfType = ScenarioManager.Get().GetObjectOfType(type);
        DebugUtils.Assert(objectOfType != null, "[ScenarioAction:Setup] ERROR - Can't find object " + text, true, DebugUtils.AssertType.Info);
        MethodInfo method = type.GetMethod(array[2]);

        if (method == null)
        {
            DebugUtils.Assert("[ScenarioAction:Setup] Can't find method - " + array[2] + " - content - " + this.m_Content, true, DebugUtils.AssertType.Info);
        }
        ParameterInfo[] parameters = method.GetParameters();
        switch (parameters.Length)
        {
        case 0:
            this.m_Method = (VDelegate)Delegate.CreateDelegate(typeof(VDelegate), objectOfType, method, false);
            break;

        case 1:
        {
            Type   parameterType = parameters[0].ParameterType;
            string text2         = array[3];
            if (parameterType == typeof(int))
            {
                this.m_ParamI1 = int.Parse(text2);
                this.m_MethodI = (VDelegateI)Delegate.CreateDelegate(typeof(VDelegateI), objectOfType, method, false);
            }
            else if (parameterType == typeof(bool))
            {
                this.m_ParamB1 = bool.Parse(text2);
                this.m_MethodB = (VDelegateB)Delegate.CreateDelegate(typeof(VDelegateB), objectOfType, method, false);
            }
            else if (parameterType == typeof(float))
            {
                this.m_ParamF1 = float.Parse(text2);
                this.m_MethodF = (VDelegateF)Delegate.CreateDelegate(typeof(VDelegateF), objectOfType, method, false);
            }
            else if (parameterType == typeof(string))
            {
                this.m_ParamS1 = text2;
                this.m_MethodS = (VDelegateS)Delegate.CreateDelegate(typeof(VDelegateS), objectOfType, method, false);
            }
            else if (parameterType.IsAssignableFrom(typeof(GameObject)))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text2;
                this.m_ParamO1     = MainLevel.Instance.FindObject(text2, (array.Length > 4) ? array[4] : string.Empty);
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodO = (VDelegateO)Delegate.CreateDelegate(typeof(VDelegateO), objectOfType, method, false);
            }
            break;
        }

        case 2:
        {
            Type   parameterType2 = parameters[0].ParameterType;
            Type   parameterType3 = parameters[1].ParameterType;
            string text3          = array[3];
            string text4          = array[4];
            if (parameterType2 == typeof(string) && parameterType3 == typeof(bool))
            {
                this.m_ParamS1  = text3;
                this.m_ParamB2  = bool.Parse(text4);
                this.m_MethodSB = (VDelegateSB)Delegate.CreateDelegate(typeof(VDelegateSB), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(string) && parameterType3 == typeof(string))
            {
                this.m_ParamS1  = text3;
                this.m_ParamS2  = text4;
                this.m_MethodSS = (VDelegateSS)Delegate.CreateDelegate(typeof(VDelegateSS), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(string) && parameterType3 == typeof(float))
            {
                this.m_ParamS1  = text3;
                this.m_ParamF2  = float.Parse(text4);
                this.m_MethodSF = (VDelegateSF)Delegate.CreateDelegate(typeof(VDelegateSF), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(int) && parameterType3 == typeof(int))
            {
                this.m_ParamI1  = int.Parse(text3);
                this.m_ParamI2  = int.Parse(text4);
                this.m_MethodII = (VDelegateII)Delegate.CreateDelegate(typeof(VDelegateII), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(int) && parameterType3 == typeof(float))
            {
                this.m_ParamI1  = int.Parse(text3);
                this.m_ParamF2  = float.Parse(text4);
                this.m_MethodIF = (VDelegateIF)Delegate.CreateDelegate(typeof(VDelegateIF), objectOfType, method, false);
            }
            else if (parameterType2.IsAssignableFrom(typeof(GameObject)) && parameterType3.IsAssignableFrom(typeof(GameObject)))
            {
                this.m_ParamO1Name = text3;
                this.m_ParamO2Name = text4;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text3);
                this.m_ParamO2     = MainLevel.Instance.GetUniqueObject(text4);
                this.m_IsGO1       = true;
                this.m_IsGO2       = true;
                if (this.m_ParamO1 == null || this.m_ParamO2 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodOO = (VDelegateOO)Delegate.CreateDelegate(typeof(VDelegateOO), objectOfType, method, false);
            }
            else if (parameterType2.IsAssignableFrom(typeof(GameObject)) && parameterType3 == typeof(float))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text3;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text3);
                this.m_ParamF2     = float.Parse(text4);
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodOF = (VDelegateOF)Delegate.CreateDelegate(typeof(VDelegateOF), objectOfType, method, false);
            }
            else if (parameterType2.IsAssignableFrom(typeof(GameObject)) && parameterType3 == typeof(string))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text3;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text3);
                this.m_ParamS2     = text4;
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodOS = (VDelegateOS)Delegate.CreateDelegate(typeof(VDelegateOS), objectOfType, method, false);
                if (method.Name == "EnableComponent" || method.Name == "DisableComponent")
                {
                    this.m_ComponentName = text4;
                }
            }
            else if (parameterType2.IsAssignableFrom(typeof(GameObject)) && parameterType3 == typeof(bool))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text3;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text3);
                this.m_ParamB2     = bool.Parse(text4);
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodOB = (VDelegateOB)Delegate.CreateDelegate(typeof(VDelegateOB), objectOfType, method, false);
            }
            else if (parameterType2.IsAssignableFrom(typeof(List <GameObject>)) && parameterType3 == typeof(bool))
            {
                this.m_ParamListO1      = new List <GameObject>();
                this.m_ParamListO1Names = text3.Split(new char[]
                    {
                        ';'
                    });
                for (int i = 0; i < this.m_ParamListO1Names.Length; i++)
                {
                    GameObject uniqueObject = MainLevel.Instance.GetUniqueObject(this.m_ParamListO1Names[i]);
                    if (uniqueObject == null)
                    {
                        this.m_HasNullObject = true;
                    }
                    else
                    {
                        this.m_ParamListO1.Add(uniqueObject);
                    }
                }
                this.m_ParamB2      = bool.Parse(text4);
                this.m_MethodListOB = (VDelegateListOB)Delegate.CreateDelegate(typeof(VDelegateListOB), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(float) && parameterType3 == typeof(float))
            {
                this.m_ParamF1  = float.Parse(text3);
                this.m_ParamF2  = float.Parse(text4);
                this.m_MethodFF = (VDelegateFF)Delegate.CreateDelegate(typeof(VDelegateFF), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(float) && parameterType3 == typeof(int))
            {
                this.m_ParamF1  = float.Parse(text3);
                this.m_ParamI2  = int.Parse(text4);
                this.m_MethodFI = (VDelegateFI)Delegate.CreateDelegate(typeof(VDelegateFI), objectOfType, method, false);
            }
            else if (parameterType2 == typeof(string) && parameterType3 == typeof(int))
            {
                this.m_ParamS1  = text3;
                this.m_ParamI2  = int.Parse(text4);
                this.m_MethodSI = (VDelegateSI)Delegate.CreateDelegate(typeof(VDelegateSI), objectOfType, method, false);
            }
            break;
        }

        case 3:
        {
            Type   parameterType4 = parameters[0].ParameterType;
            Type   parameterType5 = parameters[1].ParameterType;
            Type   parameterType6 = parameters[2].ParameterType;
            string text5          = array[3];
            string text6          = array[4];
            string text7          = array[5];
            if (parameterType4.IsAssignableFrom(typeof(GameObject)) && parameterType5 == typeof(string) && parameterType6 == typeof(string))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text5;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text5);
                this.m_ParamS1     = text6;
                this.m_ParamS2     = text7;
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodOSS = (VDelegateOSS)Delegate.CreateDelegate(typeof(VDelegateOSS), objectOfType, method, false);
            }
            else if (parameterType4 == typeof(string) && parameterType5 == typeof(string) && parameterType6 == typeof(string))
            {
                this.m_ParamS1   = text5;
                this.m_ParamS2   = text6;
                this.m_ParamS3   = text7;
                this.m_MethodSSS = (VDelegateSSS)Delegate.CreateDelegate(typeof(VDelegateSSS), objectOfType, method, false);
            }
            else if (parameterType4 == typeof(string) && parameterType5 == typeof(bool) && parameterType6 == typeof(float))
            {
                this.m_ParamS1   = text5;
                this.m_ParamB2   = bool.Parse(text6);
                this.m_ParamF3   = float.Parse(text7);
                this.m_MethodSBF = (VDelegateSBF)Delegate.CreateDelegate(typeof(VDelegateSBF), objectOfType, method, false);
            }
            else if (parameterType4.IsAssignableFrom(typeof(GameObject)) && parameterType5 == typeof(string) && parameterType6 == typeof(bool))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text5;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text5);
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_ParamS2   = text6;
                this.m_ParamB3   = bool.Parse(text7);
                this.m_MethodOSB = (VDelegateOSB)Delegate.CreateDelegate(typeof(VDelegateOSB), objectOfType, method, false);
            }
            else if (parameterType4 == typeof(string) && parameterType5 == typeof(int) && parameterType6 == typeof(bool))
            {
                this.m_ParamS1   = text5;
                this.m_ParamI2   = int.Parse(text6);
                this.m_ParamB3   = bool.Parse(text7);
                this.m_MethodSIB = (VDelegateSIB)Delegate.CreateDelegate(typeof(VDelegateSIB), objectOfType, method, false);
            }
            break;
        }

        case 4:
        {
            Type   parameterType7  = parameters[0].ParameterType;
            Type   parameterType8  = parameters[1].ParameterType;
            Type   parameterType9  = parameters[2].ParameterType;
            Type   parameterType10 = parameters[3].ParameterType;
            string paramS          = array[3];
            string text8           = array[4];
            string text9           = array[5];
            string text10          = array[6];
            if (parameterType8.IsAssignableFrom(typeof(GameObject)) && parameterType7 == typeof(string) && parameterType9 == typeof(string) && parameterType10 == typeof(string))
            {
                this.m_IsGO1       = true;
                this.m_ParamO1Name = text8;
                this.m_ParamO1     = MainLevel.Instance.GetUniqueObject(text8);
                this.m_ParamS1     = paramS;
                this.m_ParamS2     = text9;
                this.m_ParamS3     = text10;
                if (this.m_ParamO1 == null)
                {
                    this.m_HasNullObject = true;
                }
                this.m_MethodSOSS = (VDelegateSOSS)Delegate.CreateDelegate(typeof(VDelegateSOSS), objectOfType, method, false);
            }
            else if (parameterType7 == typeof(string) && parameterType8 == typeof(bool) && parameterType9 == typeof(float) && parameterType10 == typeof(int))
            {
                this.m_ParamS1    = paramS;
                this.m_ParamB2    = bool.Parse(text8);
                this.m_ParamF3    = float.Parse(text9);
                this.m_ParamI4    = int.Parse(text10);
                this.m_MethodSBFI = (VDelegateSBFI)Delegate.CreateDelegate(typeof(VDelegateSBFI), objectOfType, method, false);
            }
            break;
        }

        default:
            DebugUtils.Assert(DebugUtils.AssertType.Info);
            break;
        }
        DebugUtils.Assert(this.m_Method != null || this.m_MethodI != null || this.m_MethodB != null || this.m_MethodF != null || this.m_MethodS != null || this.m_MethodO != null || this.m_MethodII != null || this.m_MethodSB != null || this.m_MethodSS != null || this.m_MethodSF != null || this.m_MethodOF != null || this.m_MethodOS != null || this.m_MethodOO != null || this.m_MethodOB != null || this.m_MethodFF != null || this.m_MethodOSS != null || this.m_MethodOSB != null || this.m_MethodSOSS != null || this.m_MethodListOB != null || this.m_MethodSSS != null || this.m_MethodSBF != null || this.m_MethodSBFI != null || this.m_MethodFI != null || this.m_MethodSI != null || this.m_MethodSIB != null || this.m_MethodIF != null, this.m_EncodedContent, true, DebugUtils.AssertType.Info);
    }