Inheritance: MonoBehaviour
Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == GameManagerScript.Tags.SafeHaven.ToString())
     {
         ScenarioManager.GetInstance().SaveVictim(currentTarget, gameObject);
     }
 }
Esempio n. 2
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();
    }
Esempio n. 3
0
        /// <summary>
        /// Executes the actions related to OnFiltered event.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="eventArgs">FilterEventArgs.</param>
        private void HandleFilterExecute(object sender, ExecuteFilterEventArgs executeFilterEventArgs)
        {
            // Checking pending changes
            if (!CheckPendingChanges(true, true))
            {
                return;
            }

            try
            {
                // Set in the beginning.
                Context.LastOids.Clear();
                DisplaySet.FirstVisibleRow = 0;

                // Change Selected filter.
                if (executeFilterEventArgs.Arguments != null)
                {
                    InternalFilters.ExecutedFilterName = executeFilterEventArgs.Arguments.Name;
                }

                // Update data.
                UpdateData(true);
            }
            catch (Exception e)
            {
                ScenarioManager.LaunchErrorScenario(e);
            }
        }
Esempio n. 4
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());
 }
Esempio n. 5
0
    void OnGUI()
    {
        //Don't draw anything if the enum type has not been specified
        if (this.enumType == null)
        {
            return;
        }

        //Retrieve the list of enum values as ints
        int[] enumValues = EnumUtil.ArrayFromEnum(this.enumType);

        //Build the output text
        string debugText = "";

        foreach (int val in enumValues)
        {
            //Retrieve the enum value's name
            string valName = System.Enum.Parse(this.enumType, val.ToString()).ToString();

            //Determine whether or not the flag is set
            bool flagSet = ScenarioManager.GetCurrentScenario().GetFlag(val).value;

            //Append the line to the output
            debugText += valName + ": " + (flagSet ? "Set" : "Unset") + "\n";
        }

        GUI.color           = Color.black;
        GUI.backgroundColor = new Color(0, 0, 0, 0);
        GUI.Label(new Rect(0, 0, 999999, 999999), debugText);
    }
 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();
     }
 }
        /// <summary>
        /// Preferences Trigger Handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandlePreferencesTriggered(object sender, TriggerEventArgs e)
        {
            IUQueryController queryController = Parent as IUQueryController;

            if (queryController == null)
            {
                return;
            }

            if (!queryController.CheckPendingChanges(true, true))
            {
                return;
            }

            bool lRefresh = false;

            lRefresh = ScenarioManager.LaunchPreferencesScenario(queryController);

            if (!lRefresh)
            {
                return;
            }

            // Refresh all data
            OnExecuteCommand(new ExecuteCommandEventArgs(ExecuteCommandType.ExecuteRefresh));
        }
Esempio n. 8
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);
     }
 }
Esempio n. 9
0
    private void OnCollisionEnter(Collision collision)
    {
        Weapons hitBy = Weapon.GetWeaponType(collision.gameObject);

        if (this.isOpened && hitBy == Weapons.Bottle && collision.transform != this.transform.parent)
        {
            Weapon weapon = collision.gameObject.GetComponentInChildren <Weapon>();
            if (weapon != null && this.babyFood != null)
            {
                this.babyFood.AttachedTo       = weapon.transform;
                this.babyFood.IsAttached       = true;
                this.babyFood.AttachedToWeapon = weapon;
            }
        }
        else if (!this.isOpened && hitBy == Weapons.Chainsaw)
        {
            this.isOpened = true;
            if (this.anim != null && this.animClip != null)
            {
                this.anim.clip = this.animClip;
                this.anim.Play(this.animClip.name);
                this.anim[this.animClip.name].wrapMode = WrapMode.Once;
            }
        }
        else if (hitBy != Weapons.Bottle && hitBy != Weapons.Chainsaw && hitBy != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(hitBy, BabyScenario.Flags.FoodDestroyed, true);
        }
    }
Esempio n. 10
0
    private void OnCollisionEnter(Collision collision)
    {
        Weapons hitBy = Weapon.GetWeaponType(collision.gameObject);

        if (hitBy == Weapons.Knife)
        {
            this.audio.Stop();

            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(Weapons.Knife, BabyScenario.Flags.BabyChanged, true);
            if (this.anim != null && this.animClip != null)
            {
                this.anim.clip = this.animClip;
                this.anim.Play(this.animClip.name);
                this.anim[this.animClip.name].wrapMode = WrapMode.Once;

                if (this.idleAnimClip != null)
                {
                    this.anim.PlayQueued(this.idleAnimClip.name);
                    this.anim[this.idleAnimClip.name].wrapMode = WrapMode.Once;
                }

                Collider[] colliders = this.GetComponentsInChildren <Collider>();
                for (int i = 0; i < colliders.Length; ++i)
                {
                    colliders[i].enabled = false;
                }
            }
        }
        else if (hitBy != Weapons.None)
        {
            ScenarioManager.GetCurrentScenario().SetFlag <Weapons, BabyScenario.Flags>(hitBy, BabyScenario.Flags.BabyPopped, true);
        }
    }
Esempio n. 11
0
    public IEnumerator PenaltyRoutine(int playerShotsFired)
    {
        // It's fine if a few penalty points take a "long" time to process, but it needs to be fast when there's a lot of them
        float penaltyCycleInterval = m_penaltyPointInterval;

        if (playerShotsFired * m_penaltyPointInterval > m_penaltySpeedUpTimeLimit)
        {
            penaltyCycleInterval = Mathf.Clamp(m_penaltySpeedUpTimeLimit / playerShotsFired, m_penaltyPointIntervalMin, m_penaltyPointInterval);
        }

        //Debug.Log(DebugUtilities.AddTimestampPrefix("Shots penalty being applied! Cycle interval: " + penaltyCycleInterval));

        int penaltyAmount = 0;

        while (playerShotsFired > 0)
        {
            playerShotsFired--;
            ScenarioManager.SetShotsFired(playerShotsFired);
            ScenarioManager.ModifyScore(-5);

            penaltyAmount += 5;
            SetPenaltyAmount(-penaltyAmount);

            if (m_penaltyPointSFX != null)
            {
                Debug.Log(DebugUtilities.AddTimestampPrefix("Chuck!"));
                m_penaltyPointSFX.PlayOnSource(m_uiAudio);
            }

            yield return(new WaitForSecondsRealtime(penaltyCycleInterval));
        }
    }
        /// <summary>
        /// Showes the data of the instance.
        /// </summary>
        /// <param name="lOids">The instance Oid list</param>
        private void ShowData(List <Oid> lOids)
        {
            // Query by instance
            DataTable lData = null;

            if (lOids != null && lOids.Count > 0)
            {
                try
                {
                    // Logic API call.
                    lData = Logic.ExecuteQueryInstance(Logic.Agent, OidSelector.Domain, lOids[0], this.BuildDisplaySetAttributes());
                }
                catch (Exception logicException)
                {
                    ScenarioManager.LaunchErrorScenario(logicException);
                }
            }

            // Clear Oid Selector value.
            if (lData != null && lData.Rows.Count == 0)
            {
                mOidSelector.Value = null;
            }

            // Show Population.
            SetPopulation(lData, true, lOids);
        }
Esempio n. 13
0
    //This method needs to be called in the Awake() or Start() method of every concrete subclass
    protected void InitialiseScenario()
    {
        //Initialise the list of queued flag changes
        this.queuedFlagChanges = new Queue <KeyValuePair <int, FlagValue> >();

        //Initialise the list of flags
        this.flags = new Dictionary <int, FlagValue>();
        int[] flagKeys = EnumUtil.ArrayFromEnum(this.GetEnumType());
        foreach (int key in flagKeys)
        {
            this.flags[key] = new FlagValue(0, false);
        }

        //Initialise the list of flag triggers
        this.flagTriggers = new List <FlagTriggerDetails>();

        //When the scenario first becomes active, set it as the current scenario
        ScenarioManager.SetCurrentScenario(this);

        //If there is a flags debug instance present, set our enum type for it
        FlagsDebugDisplay flagDebug = this.gameObject.GetComponent <FlagsDebugDisplay>();

        if (flagDebug != null)
        {
            flagDebug.enumType = this.GetEnumType();
        }
    }
Esempio n. 14
0
        /// <summary>
        /// Initialize the form
        /// </summary>
        public void Initialize(List <Oid> selectedOids)
        {
            mSelectedOids = selectedOids;

            // If no instances selected, inform and exit
            if (mSelectedOids == null || mSelectedOids.Count == 0)
            {
                string    lMessageError = CultureManager.TranslateString(LanguageConstantKeys.L_NO_SELECTION, LanguageConstantValues.L_NO_SELECTION);
                Exception lException    = new Exception(lMessageError, null);
                ScenarioManager.LaunchErrorScenario(lException);
                return;
            }

            cmbBoxSelectTemplate.SelectedIndexChanged += new EventHandler(HandlecmbBoxSelectTemplate_SelectedIndexChanged);

            // Load the templates from configuration file and fill the Combo
            LoadReportTemplates();

            // Show the number of selected instances in the Title.
            Text = CultureManager.TranslateStringWithParams(LanguageConstantKeys.L_ELEMENTSELECTED, LanguageConstantValues.L_ELEMENTSELECTED, mSelectedOids.Count);
            // Set the default printer
            lblNameOfPrint.Text = printDlg.PrinterSettings.PrinterName;

            ShowDialog();
        }
Esempio n. 15
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);
 }
        /// <summary>
        /// Initializes the input fields properties.
        /// </summary>
        public override void Initialize()
        {
            #region Initialize Arguments Controller

            InternalInputFields.Initialize();

            #endregion Initialize Arguments Controller

            #region Initial Context Arguments Configuration
            // Initial Context Arguments Configuration
            ConfigureInitialContext();
            #endregion Initial Context Arguments Configuration

            try
            {
                #region Exectute Logic Default Values
                // Load default values.

                // Call Logic API ExecuteDefaultValues().
                ExecuteDefaultValues(Context);

                #endregion Exectute Logic Default Values

                #region Execue Load From Context
                // Load valued from context.
                ExecuteLoadFromContext(Context);
                #endregion xecue Load From Context
            }
            catch (Exception logicException)
            {
                ScenarioManager.LaunchErrorScenario(logicException);
            }

            base.Initialize();
        }
Esempio n. 17
0
    public void Command(Dictionary <string, string> command)
    {
        //var scenario = ScenarioManager.Instance;
        var fileName = command["fileName"];

        ScenarioManager.UpdateLines(fileName);
    }
        private void OpenScenarionManager(object sender, RoutedEventArgs e)
        {
            var scenarioManagerDialog = new ScenarioManager();

            scenarioManagerDialog.Owner = Window.GetWindow(this);
            scenarioManagerDialog.Show();
        }
Esempio n. 19
0
    public void SetStateInternal(GameState state)
    {
        if (m_state == state)
        {
            return;
        }

        Debug.Log(DebugUtilities.AddTimestampPrefix("Game state changing from " + m_state + " to " + state));

        m_state = state;

        if (state == GameState.Demo)
        {
            SetVolume(-80f);
            ScenarioManager.InitializeScenario(m_scenario);
            ScenarioManager.StartRound(0);
            UserInterface.StartDemoRoutine();
        }
        if (state == GameState.Game)
        {
            SetVolume(0f);
            ScenarioManager.InitializeScenario(m_scenario);
            ScenarioManager.StartRound(0);
        }
    }
Esempio n. 20
0
    // Update is called once per frame
    void Update()
    {
        if (path != null)
        {
            currentTarget = path.pathPoints[pathIndex].transform;

            if (Vector3.Distance(currentTarget.transform.position, transform.position) < 0.5f)
            {
                pathIndex++;
                if (pathIndex >= path.pathPoints.Count)
                {
                    if (path == pathList[0])
                    {
                        if (leftPath)
                        {
                            path = pathList[1];
                        }
                        else
                        {
                            path = pathList[2];
                        }
                        pathIndex = 0;
                    }
                    else
                    {
                        ScenarioManager.Instance().GoToNextScenario();
                        path = null;
                    }
                }
            }
        }
        agent.SetDestination(currentTarget.position);
    }
Esempio n. 21
0
 // Update is called once per frame
 private void Start()
 {
     scenarioManager = this;
     victims         = new List <GameObject>();
     items           = new List <Item>();
     enemies         = new List <GameObject>();
 }
Esempio n. 22
0
        public static void TestCloud(string[] args)
        {
            Console.WriteLine("프로그램 시작");
            var irs = new List <double> {
                0.01
            };

            for (int i = 1; i < 14; i++)
            {
                irs.Add(0.01 + 0.001 * i);
            }

            var sp = new LiabilityCalc.ScenParams()
            {
                SourceCurve = irs, HW_a = 0.1, HW_sigma = 0.01, EqSigma = 0.27, BondSigma = 0.01
            };

            ScenarioManager sm = new ScenarioManager(sp, 1200);

            Tools.DBConnParams dbP = new Tools.DBConnParams(new string[] { args[1], args[2], args[3], args[4] });

            int scenCnt = 100;

            sm.SetScenDataFromFile(scenCnt);

            Console.WriteLine("시나리오 생성 완료");

            for (int i = 1; i <= scenCnt; i++)
            {
                sm.SetCurrentScen(i);
                InsertScenToDB(args[0], sm.CurrentScenNo, sm.CurrentScenData, dbP);
                Console.WriteLine($@"시나리오 {i}번 입력 완료");
            }
        }
Esempio n. 23
0
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;
        }

        _miniWait   = new WaitForSeconds(_miniDelayLength);
        _shortWait  = new WaitForSeconds(_shortDelayLength);
        _mediumWait = new WaitForSeconds(_mediumDelayLength);
        _longWait   = new WaitForSeconds(_longDelayLength);

        informationManager = GameObject.Find("InformationManager").GetComponent <InformationManager>();
        scenarioManager    = GameObject.Find("ScenarioManager").GetComponent <ScenarioManager>();
        audioManager       = GameObject.Find("AudioManager").GetComponent <AudioManager>();
        characterHandler   = GetComponent <CharacterHandler>();
        itemHandler        = GetComponent <ItemHandler>();
        interfaceHandler   = GetComponent <InterfaceHandler>();
        eventHandler       = GetComponent <EventHandler>();
        pollHandler        = GetComponent <PollHandler>();
        arrowHandler       = GetComponent <ArrowHandler>();
        twitchManager      = GameObject.Find("TwitchManager").GetComponent <TwitchManager>();

        OnRessourceValueChange += VariableChangeRessourcesHandler;
    }
Esempio n. 24
0
 /******************************************
  *
  * public void HitEnemy(GameObject player, GameObject enemy)
  *		Signals the PBManager that the player hit the enemy, for statistical reference,
  *		removes the enemy from the list, checks if a new scenario should be loaded,
  *		and destryos the enemy GameObject;
  *
  * Parameters
  *		int playerID - The number ID for the new player.
  * Return
  *
  * ***************************************/
 public void HitEnemy(GameObject player, GameObject enemy)
 {
     PlayerBehaviourManager.GetInstance().HitEnemy(player, enemy);
     ScenarioManager.GetInstance().enemies.Remove(enemy);
     ScenarioManager.GetInstance().CheckNewScenario();
     Destroy(enemy);
 }
Esempio n. 25
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;
        }
Esempio n. 26
0
 private void Start()
 {
     m_scenario = GetComponent <ScenarioManager>();
     m_stats    = GetComponent <StatsManager>();
     m_scene    = GetComponent <ScenesManager>();
     m_audio    = GameObject.Find("Audio Source").GetComponent <AudioInterface>();
     state      = State.Processing;
 }
Esempio n. 27
0
 /******************************************
  *
  * private void OnCollisionEnter2D(Collision2D collision)
  *		If the player collides with an Item, activates the powerUp
  *
  * Parameters
  *       Collision2D collision - Unity default parameter
  * Return
  *
  * ***************************************/
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Item")
     {
         ScenarioManager.GetInstance().GetItem(gameObject, collision.gameObject);
         ActivatePowerUp();
     }
 }
Esempio n. 28
0
 void OnTriggerEnter(Collider other)
 {
     //If the table entered the target zone, set the flag accordingly
     if (other.gameObject.tag == "Table")
     {
         ScenarioManager.GetCurrentScenario().SetFlag(Weapons.None, CandleRoomScenario.Flags.TableInPosition, true);
     }
 }
 void Awake()
 {
     if (scenarist != null)
     {
         Destroy(scenarist);
     }
     scenarist = this;
 }
Esempio n. 30
0
 public void Awake()
 {
     if (Instance != null)
     {
         Destroy(Instance.gameObject);
     }
     Instance = this;
 }
Esempio n. 31
0
 public override void Initialize()
 {
     controlscript = GetComponent<ControlScript> ();
     battlegooey = GetComponent<BattleGooey>();
     scenariomanager = GetComponent<ScenarioManager> ();
     Debug.Log (scenariomanager);
     timer = battlegooey.SetTimerTime (totaltimetojump);
     scenariomanager.Initialize ();
     scenariomanager.InitializeScenario ();
 }
Esempio n. 32
0
 void Awake()
 {
     scenario_manager = this;
 }