示例#1
0
        public override bool InstantExecute(GameObject invoker, IAction[] actions, int index)
        {
            GameObjectToFind = GameObject.Find(NameOfGameObjectToFind);
            VariablesManager.SetGlobal(GlobalGOVarName, GameObjectToFind);

            return(true);
        }
示例#2
0
        public void SetSfxLvl(float sfxLvl)
        {
            MasterMixer.SetFloat(FXVar, sfxLvl);

            Debug.Log(sfxLvl);
            VariablesManager.SetGlobal(FXVar, sfxLvl);
        }
示例#3
0
        static void Main(string[] args)
        {
            try
            {
                CheckArgumentsHaveBeenSupplied(args);
                var scriptPath  = args[0];
                var scriptToRun = args[1];

                CheckScriptPathIsValid(scriptPath);

                var scriptCollection = ScriptLoader.LoadScripts(CreateBinaryReaderForScriptFile(scriptPath));

                CheckScriptNameIsValid(scriptCollection, scriptToRun);

                var fnRoutinesCaller  = new FnRoutinesCaller();
                var variablesManager  = new VariablesManager();
                var stack             = new ValueStack();
                var scriptInterpreter = new ScriptInterpreter(scriptToRun, scriptCollection[scriptToRun], fnRoutinesCaller, variablesManager, stack);
                scriptInterpreter.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
            Console.WriteLine("Done");
        }
示例#4
0
        public void dropdown_indexchanged()
        {
            float slot = (float)savesDropdown.value;
            float num  = count - (slot);

            VariablesManager.SetGlobal(loadSlotVariable, num);
        }
示例#5
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Checkpoint")  //if player reaches a checkpoint, then respawnLocation is set to the position of said checkpoint
        {
            respawnLocation = other.transform.position;
        }
        else if (other.tag == "EnemyBullet")
        {
            if (playerHealth <= 1)
            {
                SceneManager.LoadScene(2); //upon dying, the player will be sent back to the hub
                playerHealth = 6;          //health is reset
            }

            playerHealth -= 1;
            VariablesManager.SetGlobal("PlayerHit", true);
            Debug.Log("Player Hit");
        }
        else if (other.tag == "DeathZone")
        {
            transform.position = respawnLocation;//teleport player to last checkpoint when they fall off level

            if (playerHealth <= 2)
            {
                SceneManager.LoadScene(2); //upon dying, the player will be sent back to the hub
                playerHealth = 6;          //health is reset
            }

            playerHealth -= 1;
        }
    }
示例#6
0
        public void OnDrag(PointerEventData eventData)
        {
            Vector2 position = Vector2.zero;

            RectTransformUtility.ScreenPointToLocalPointInRectangle(
                this.jsContainer.rectTransform,
                eventData.position,
                eventData.pressEventCamera,
                out position
                );

            position.x = (position.x / this.jsContainer.rectTransform.sizeDelta.x);
            position.y = (position.y / this.jsContainer.rectTransform.sizeDelta.y);

            x = (Mathf.Approximately(this.jsContainer.rectTransform.pivot.x, 1f)) ? position.x * 2 + 1 : position.x * 2 - 1;
            y = (Mathf.Approximately(this.jsContainer.rectTransform.pivot.y, 1f)) ? position.y * 2 + 1 : position.y * 2 - 1;

            if ((y > 0.6 || y < -0.6) && (runwalk == true))
            {
                player.characterLocomotion.canRun = true;
                VariablesManager.SetGlobal("PlayerRunning", true);
            }
            else
            {
                player.characterLocomotion.canRun = false;
                VariablesManager.SetGlobal("PlayerRunning", false);
            }
        }
示例#7
0
        void Start()
        {
            count = SaveLoadManager.Instance.GetSavesCount();
            VariablesManager.SetGlobal(saveSlotVariable, count);


            Debug.Log("get saves count returns" + count);

            savesDropdown.ClearOptions();

            var dictionary = SaveLoadManager.Instance.savesData.profiles;


            foreach (KeyValuePair <int, SavesData.Profile> item in dictionary)
            {
                Debug.Log("Save profile ID: " + item.Key);
                Debug.Log("Save profile date: " + item.Value.date);


                slots.Add(item.Value.date.ToString());
            }

            slots.Reverse();
            savesDropdown.AddOptions(slots);

            VariablesManager.SetGlobal(loadSlotVariable, count);
        }
示例#8
0
 private void Start()
 {
     gm        = FindObjectOfType <GManager>();
     vm        = FindObjectOfType <VariablesManager>();
     mf.active = launched;
     //mf.dir = startingDirection;
 }
    private void Start()
    {
        if (vm == null)
        {
            vm = FindObjectOfType <VariablesManager>();
        }

        rClick = GetComponent <RotateSelf>();
        if (rClick == null)
        {
            rClick = gameObject.AddComponent <RotateSelf>();
        }


        if (spriteTF == null)
        {
            spriteTF = GetComponentInChildren <SpriteRenderer>().transform;
        }
        dir = rClick.RotateSprite(spriteTF, dir, false);

        if (startRandom)
        {
            dir = vm.GetRandomDir();
            rClick.RotateSprite(spriteTF, dir, false);
        }
    }
示例#10
0
    public void Start()
    {
        LoggingManager.startLogging();

        VariablesManager.getConfigValues();

        Debug.Log("HidingDuration = " + VariablesManager.HidingDuration + "\nRoundSpeed = " + VariablesManager.RoundSpeed);
        Debug.Log("DoubleFileTotalBugs = " + VariablesManager.DoubleFileTotalBugs);

        secondsForFirtstPart = 3000;
        secondsForSecondPart = 3000;
        secondsForThirdPart  = 15000;

        currentStage    = Globals.STAGE_STARTING;
        guiTimerManager = Globals.guiTimerManager;
        treeManager     = Globals.treeManager;
        cameraManager   = Globals.cameraManager;
        //shieldManager = Globals.shieldManager;
        hazardManager = Globals.hazardManager;

        totalSeconds = secondsForFirtstPart;
        guiTimerManager.SetTotalSeconds(totalSeconds);

        lives = 1f;
        GameStart();
    }
示例#11
0
        public void SetMusicLvl(float musicLvl)
        {
            MasterMixer.SetFloat(MusicVar, musicLvl);

            Debug.Log(musicLvl);
            VariablesManager.SetGlobal(MusicVar, musicLvl);
        }
示例#12
0
        public override void OnGUI(int WindowID)
        {
            location = (VariableLocation)EditorGUILayout.EnumPopup("Source:", location);


            if (location == VariableLocation.Global)
            {
                if (AdvGame.GetReferences().variablesManager)
                {
                    VariablesManager variablesManager = AdvGame.GetReferences().variablesManager;

                    parameterID = AC.Action.ChooseParameterGUI("Variable:", parameters, parameterID, ParameterType.GlobalVariable);
                    if (parameterID >= 0)
                    {
                        variableID = ShowVarGUI(parameters, variablesManager.vars, variableID, false);
                    }
                    else
                    {
                        variableID = ShowVarGUI(parameters, variablesManager.vars, variableID, true);
                    }
                }
            }

            else if (location == VariableLocation.Local)
            {
                if (localVariables)
                {
                    parameterID = AC.Action.ChooseParameterGUI("Variable:", parameters, parameterID, ParameterType.LocalVariable);
                    if (parameterID >= 0)
                    {
                        variableID = ShowVarGUI(parameters, localVariables.localVars, variableID, false);
                    }
                    else
                    {
                        variableID = ShowVarGUI(parameters, localVariables.localVars, variableID, true);
                    }
                }
            }


            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("If condition is met:");
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            AddConnectionButton(0);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("If condition is not met:");
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            AddConnectionButton(1);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            GUI.DragWindow();
        }
示例#13
0
        public ScriptSystem()
        {
            GlobalVariables = new VariablesManager();
            var fnRoutinesCaller = new FnRoutinesCaller(GlobalVariables);
            var valueStack       = new ValueStack();

            _interpreter = new ScriptInterpreter(fnRoutinesCaller, GlobalVariables, valueStack);
        }
示例#14
0
	void Start () {
        varManager = GetComponent<VariablesManager>();
        eventsManager = GetComponent<EventsManager>();

        ImportVariables();
        ImportEvents();
        GetComponent<TimeManager>().AddYearVariable();
    }
示例#15
0
 void OnTriggerEnter(Collider c)
 {
     if (c.CompareTag("Rock"))
     {
         appleCount++;
         VariablesManager.SetGlobal("AppleCount", appleCount);
     }
 }
示例#16
0
 private void Update()
 {
     if ((float)VariablesManager.GetGlobal("CollectedPieces") == 7f && (float)VariablesManager.GetGlobal("CompletedLevel1") == 0f)
     {
         VariablesManager.SetGlobal("CompletedLevel1", 1f);
         StartCoroutine(LoadLevel());
     }
 }
示例#17
0
    void Start()
    {
        varManager    = GetComponent <VariablesManager>();
        eventsManager = GetComponent <EventsManager>();

        ImportVariables();
        ImportEvents();
        GetComponent <TimeManager>().AddYearVariable();
    }
示例#18
0
    // Start is called before the first frame update
    void Start()
    {
        // Removes collected pieces when loading level
        if (pieceToDelete1 != null)
        {
            if (currentScene.ToString().Equals("Scenes/Level_1"))
            {
                if ((float)VariablesManager.GetGlobal("CollectedPiece1") == 1f)
                {
                    pieceToDelete1.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece2") == 1f)
                {
                    pieceToDelete2.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece3") == 1f)
                {
                    pieceToDelete3.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece4") == 1f)
                {
                    pieceToDelete4.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece5") == 1f)
                {
                    pieceToDelete5.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece6") == 1f)
                {
                    pieceToDelete6.SetActive(false);
                }

                if ((float)VariablesManager.GetGlobal("CollectedPiece7") == 1f)
                {
                    pieceToDelete7.SetActive(false);
                }
            }
        }

        // Fixes volume sliders being messed up on scene load
        musicSlider.value = (float)VariablesManager.GetGlobal("MusicMix");
        fxSlider.value    = (float)VariablesManager.GetGlobal("FXMix");

        // Correctly updates score when loading level
        float currentScore = (float)VariablesManager.GetGlobal("CollectedPieces");

        if (textScore != null)
        {
            textScore.text = currentScore + "/7";
        }
    }
示例#19
0
    private void Start()
    {
        vm = FindObjectOfType <VariablesManager>();
        gm = FindObjectOfType <GManager>();
        rs = GetComponent <RotateSelf>();
        rs.RotateSprite(spriteTF, dir, false);
        currentWait = startSteps;

        gm.turnStep.AddListener(TurnStep);
    }
        /// <summary>
        /// Gets the variable ID array. To add a new variable, AC needs a reference to the
        /// current IDs. This generates the list of current IDs.
        /// </summary>
        /// <returns>The variable ID array.</returns>
        /// <param name="variablesManager">Variables manager.</param>
        private static int[] GetVarIDArray(VariablesManager variablesManager)
        {
            List <int> idArray = new List <int>();

            foreach (GVar var in GlobalVariables.GetAllVars())
            {
                idArray.Add(var.id);
            }
            idArray.Sort();
            return(idArray.ToArray());
        }
        private void RVHHLevelVarForm_Shown(object sender, EventArgs e)
        {
            try
            {
                // get all HH-level variables from the variables file
                List <string> hhVars = (from v in EM_AppContext.Instance.GetVarConfigFacade().GetVarConfig().Variable
                                        where VariablesManager.IsHHLevel(v) && v.Name.ToLower() != DefVarName.IDHH.ToLower()
                                        select v.Name.ToLower()).ToList();
                // gather the files to check: those fulfilling the pattern and the custom ones
                if (Directory.Exists(dataPath))
                {
                    foreach (string f in Directory.GetFiles(dataPath, namePattern))
                    {
                        dataToCheck.Add(Path.Combine(dataPath, f));
                    }
                }

                // do the checking, showing a progress bar
                // the background-worker gets 2 parameters:
                // - the list of HH-level variables and
                // - the list of files to check
                ProgressIndicator progressIndicator = new ProgressIndicator(CheckData_BackgroundEventHandler, "Checking Data ...",
                                                                            new Tuple <List <string>, List <string> >(hhVars, dataToCheck));
                if (progressIndicator.ShowDialog() != DialogResult.OK)
                {
                    Close(); return;
                }                                                                           // user pressed Cancel

                // interpret the results
                // the background-worker returns 2 results:
                // - the list of variables, each variable with a list of the file(s) that caused problems, and an empty list if there are no problems
                // - a (hopefully empty) list of critical errors, i.e. one for each file that could not be analysed
                Dictionary <string, List <string> > hhVarResults = (progressIndicator.Result as Tuple <Dictionary <string, List <string> >, List <string> >).Item1;
                List <string> problemData = (progressIndicator.Result as Tuple <Dictionary <string, List <string> >, List <string> >).Item2;

                if (problemData.Count > 0)
                {
                    UserInfoHandler.ShowError("The following data could not be checked:" + Environment.NewLine + string.Join(Environment.NewLine, problemData));
                    if (problemData.Count == dataToCheck.Count)
                    {
                        Close(); return;
                    }                                                                // checking failed for all data-files
                }

                // show the results in the grid
                foreach (var result in hhVarResults)
                {
                    string problems = result.Value.Count == 0 ? "No problems found for the checked files" : string.Join(SEPARATOR, result.Value);
                    dgvVar.Rows.Add(result.Key, problems);
                }
            }
            catch (Exception exception) { UserInfoHandler.ShowException(exception); Close(); }
        }
示例#22
0
 /// <summary>
 /// Inicializamos instance
 /// </summary>
 void Awake()
 {
     //Asigna esta instancia al campo instance
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);  //Garantiza que sólo haya una instancia de esta clase
     }
 }
示例#23
0
    private void UpdateSelf()
    {
        if (AdvGame.GetReferences() && AdvGame.GetReferences().variablesManager)
        {
            VariablesManager variablesManager = AdvGame.GetReferences().variablesManager;

            localVars.Clear();
            foreach (GVar assetVar in variablesManager.vars)
            {
                localVars.Add(new GVar(assetVar));
            }
        }
    }
        void VariablesForm_Load(object sender, EventArgs e)
        {
            string helpPath; EM_AppContext.Instance.GetHelpPath(out helpPath); helpProvider.HelpNamespace = helpPath;

            btnSwitchablePolicies.Enabled = !EM_AppContext.Instance.IsPublicVersion();

            try
            {
                _undoManager = new ADOUndoManager();
                _undoManager.AddDataSet(_varConfigFacade._varConfig);
                _acronymManager   = new AcronymManager(this);
                _variablesManager = new VariablesManager(this);

                _acronymManager.FillAcronymsList();
                _variablesManager.FillVariablesList();

                //fill the combo-box containing all countries to filter for country specific descriptions
                RepositoryItemComboBox ricmbCountry = cmbCountry.Edit as RepositoryItemComboBox;
                ricmbCountry.Items.Clear();
                ricmbCountry.Items.Add(_anyCountry);
                foreach (CountryAdministration.Country country in CountryAdministration.CountryAdministrator.GetCountries())
                {
                    ricmbCountry.Items.Add(country._shortName);
                }
                cmbCountry.EditValue = _anyCountry;

                //fill the combo-box containing all acronym types for searching an acronym
                //(should actually be updated if an acronym type is added/removed, but considering this is a very uncommon event and a rather unimportant function ...)
                RepositoryItemComboBox ricmbAcronymType = cmbAcronymType.Edit as RepositoryItemComboBox;
                ricmbAcronymType.Items.Clear();
                ricmbAcronymType.Items.Add(_allAcronymTypes);
                foreach (VarConfig.AcronymTypeRow acroTypeRow in _varConfigFacade.GetAllAcronyms())
                {
                    ricmbAcronymType.Items.Add(acroTypeRow.LongName.ToUpper());
                }
                cmbAcronymType.EditValue = ricmbAcronymType.Items[0].ToString();

                //add data-dependant filter-checkboxes (show benefit variables, show demographic variables, ...)
                DrawFilterCheckboxes();

                //_varConfigFacade contains a list of variables and acronyms created in the current session
                _varConfigFacade.ClearNewRowsList();

                SetButtonGreyState();
            }
            catch (Exception exception)
            {
                Tools.UserInfoHandler.ShowException(exception);
            }
        }
示例#25
0
        public void SetSound()
        {
            MasterMixer.GetFloat(MusicVar, out musicLvl);
            Music.value = musicLvl;

            MasterMixer.GetFloat(FXVar, out sfxLvl);
            FX.value = sfxLvl;

            VariablesManager.GetGlobal("musicLvl");
            VariablesManager.GetGlobal("sfxLvl");

            Debug.Log(sfxLvl);
            Debug.Log(musicLvl);
        }
示例#26
0
    void Shoot()
    {
        if (Physics.Raycast(transform.position, transform.forward, out hit, range))
        {
            VariablesManager.SetGlobal("RaygunShot", true);

            Debug.Log(hit.transform.name);
            Debug.DrawRay(transform.position, transform.forward * 100, Color.red, 3f);

            GameObject laser = GameObject.Instantiate(laserPrefab, transform.position, transform.rotation) as GameObject;
            laser.GetComponent <ShotBehavior>().setTarget(hit.point);
            GameObject.Destroy(laser, 2f);
        }
    }
        internal override bool Perform()
        {
            DataGridViewRow changedRow = _dgvVariables.Rows[_eventArgs.RowIndex];

            VarConfig.VariableRow variableRow = changedRow.Tag as VarConfig.VariableRow;

            if (_eventArgs.ColumnIndex == _dgvVariables.Columns.IndexOf(_variablesForm.colVariableName))
            {     //variables name edited
                if (variableRow.Name != changedRow.Cells[_eventArgs.ColumnIndex].Value.ToString())
                { //only (change and) return true if actually changed
                    variableRow.Name = changedRow.Cells[_eventArgs.ColumnIndex].Value.ToString();
                    int columnIndexAutoLabel = _variablesForm.dgvVariables.Columns.IndexOf(_variablesForm.colAutomaticLabel);
                    variableRow.AutoLabel = changedRow.Cells[columnIndexAutoLabel].Value.ToString();
                    return(true);
                }
            }

            if (_eventArgs.ColumnIndex == _dgvVariables.Columns.IndexOf(_variablesForm.colMonetary))
            {//checkbox monetary edited
                bool newValue_IsMonetary = (bool)changedRow.Cells[_eventArgs.ColumnIndex].Value;
                if (VariablesManager.IsMonetary(variableRow) && !newValue_IsMonetary)
                {//current value monetary, new value non-monetary
                    variableRow.Monetary = "0";
                    return(true);
                }
                if (!VariablesManager.IsMonetary(variableRow) && newValue_IsMonetary)
                {//current value non-monetary, new value monetary
                    variableRow.Monetary = "1";
                    return(true);
                }
            }

            if (_eventArgs.ColumnIndex == _dgvVariables.Columns.IndexOf(_variablesForm.colHHLevel))
            {//checkbox HH Level edited
                bool newValue_IsHHLevel = (bool)changedRow.Cells[_eventArgs.ColumnIndex].Value;
                if (VariablesManager.IsHHLevel(variableRow) && !newValue_IsHHLevel)
                {//current value hh-level, new value ind-level
                    variableRow.HHLevel = "0";
                    return(true);
                }
                if (!VariablesManager.IsHHLevel(variableRow) && newValue_IsHHLevel)
                {//current value ind-level, new value hh-level
                    variableRow.HHLevel = "1";
                    return(true);
                }
            }

            return(false);
        }
        public override IEnumerator Execute(GameObject target, IAction[] actions, int index)
        {
            animElement = canvasElement.GetComponent <RectTransform>();
            VariablesManager.SetLocal(canvasElement, "originalPosition", animElement.localPosition, true);


            AnimOutPositionTop    = new Vector3(animElement.localPosition.x, Screen.height, animElement.localPosition.z);
            AnimOutPositionBottom = new Vector3(animElement.localPosition.x, -Screen.height, animElement.localPosition.z);
            AnimOutPositionLeft   = new Vector3(-Screen.width, animElement.localPosition.y, animElement.localPosition.z);
            AnimOutPositionRight  = new Vector3(Screen.width, animElement.localPosition.y, animElement.localPosition.z);

            {
                switch (this.alignment)
                {
                case ALIGN.Top:

                    animElement.localPosition = AnimOutPositionTop;

                    break;

                case ALIGN.Bottom:

                    animElement.localPosition = AnimOutPositionBottom;

                    break;

                case ALIGN.Left:


                    animElement.localPosition = AnimOutPositionLeft;



                    break;

                case ALIGN.Right:

                    animElement.localPosition = AnimOutPositionRight;



                    break;
                }
            }


            yield return(0);
        }
        internal override bool Perform()
        {
            VarConfig.VariableRow variableRow = _varConfigFacade.AddVariable();

            int index = 0;

            if (_dgvVariables.SelectedRows.Count == 1)
            {
                index = _dgvVariables.Rows.IndexOf(_dgvVariables.SelectedRows[0]) + 1;
            }
            _dgvVariables.Rows.Insert(index, variableRow.Name, VariablesManager.IsMonetary(variableRow),
                                      VariablesManager.IsHHLevel(variableRow), false, variableRow.AutoLabel);
            _dgvVariables.Rows[index].Tag = variableRow;
            _dgvVariables.Rows[index].Cells[0].Selected = true; //set input focus to just added row (selecting row instead of cell does not work)
            _dgvVariables.Select();                             //grid view must be selected too, otherwise another list may have the input focus
            return(true);
        }
示例#30
0
        // Find actual waypoint and store it.
        private bool FindNextWp()
        {
            //select random number and select a waypoint from array with this number.
            _index      = Random.Range(0, SharedWPs.Length);
            _testTarget = SharedWPs[_index];

            // check if WP is in range of maxRange from npc
            if ((gameObject.transform.position - SharedWPs[_index].transform.position).magnitude < NxtTargetMaxRange)
            {
                // it is in range, now store it in GC next target variable.
                if (myDebug)
                {
                    Debug.Log("Range to target: " + (gameObject.transform.position - SharedWPs[_index].transform.position).magnitude);
                }

                VariablesManager.SetLocal(this.NextTarget.local.targetObject, this.NextTarget.local.ToString(), SharedWPs[_index]);
                return(true);
            }

            return(false);
        }
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            Transform originTransform = this.origin.GetTransform(target);

            if (originTransform == null)
            {
                return(true);
            }

            Collider[]        colliders = this.GatherColliders(target);
            List <GameObject> array     = new List <GameObject>();

            string compareTag = this.withTag.GetValue(target);

            for (int i = 0; i < colliders.Length; ++i)
            {
                if (colliders[i].gameObject.CompareTag(compareTag))
                {
                    array.Add(colliders[i].gameObject);
                }
            }

            array.Sort((x, y) =>
            {
                float distanceX = Vector3.Distance(originTransform.position, x.transform.position);
                float distanceY = Vector3.Distance(originTransform.position, y.transform.position);
                return(distanceX.CompareTo(distanceY));
            });

            ListVariables list = this.listVariables.GetListVariables(target);

            VariablesManager.ListClear(list);

            foreach (GameObject element in array)
            {
                VariablesManager.ListPush(list, ListVariables.Position.Last, element);
            }

            return(true);
        }
 void Start()
 {
     varManager = GetComponent<VariablesManager>();
 }