public ScriptContainer(TerminalScript script) { this.script = script; ImageIndex = script.ScriptTarget == TerminalScript.TerminalScriptTarget.График ? 0 : script.ScriptTarget == TerminalScript.TerminalScriptTarget.Терминал ? 1 : script.ScriptTarget == TerminalScript.TerminalScriptTarget.Тикер ? 2 : 0; }
private void AddNewScript() { // выбрать тип скрипта var scriptTypes = TerminalScript.GetAllTerminalScripts(); var dialog = new ListSelectDialog(); dialog.Initialize(scriptTypes.Keys.Cast <object>().ToList(), "", Localizer.GetString("TitleSelectScript")); if (dialog.ShowDialog() != DialogResult.OK) { return; } var selectedScript = (string)dialog.SelectedItem; // создать скрипт с параметрами по-умолчанию var script = TerminalScript.MakeScriptByScriptName(selectedScript); // добавить в таблицу var scripts = gridScripts.rows.Select(r => (TerminalScript)r.ValueObject).ToList(); scripts.Add(script); gridScripts.DataBind(scripts); gridScripts.Invalidate(); // сохранить настройки ScriptManager.Instance.UpdateScripts(GetScriptsFromTable()); }
// Update is called once per frame void Update() { Vector3 forward = transform.TransformDirection(Vector3.forward); //create the forward vector in direction the player is facing RaycastHit hit; /* only when e is pressed, cast a ray forward for 5 meters that only detects items on the interact layer, which are all terminals */ if (!escMenu.enabled && !upgradeMenu.enabled && Input.GetKeyDown(KeyCode.E) && Physics.Raycast(transform.position, forward, out hit, interactDistance, layerMask)) { buildMenu.enabled = true; //enable build menu control.lockPlayerInput(true); //lock player movement and looking Cursor.visible = true; TerminalScript hitTarget = hit.transform.GetComponentInParent <TerminalScript>(); //set which terminal was interacted with control.setBuildTarget(hitTarget); //tell controller which terminal was hit buildMenu.GetComponent <BuildMenu>().updateMenu(); //update build menu } else if (!escMenu.enabled && !buildMenu.enabled && Input.GetKeyDown(KeyCode.K)) //k press opens upgrade menu { upgradeMenu.enabled = true; //enable the menu control.lockPlayerInput(true); //lock player movement and looking Cursor.visible = true; upgradeMenu.GetComponent <UpgradeMenu>().updateMenu(); //update upgrade menu } else if (Input.GetKeyDown(KeyCode.P) && !buildMenu.enabled && !upgradeMenu.enabled) { escMenu.enabled = true; control.lockPlayerInput(true); Cursor.visible = true; } }
// Use this for initialization void Start() { coll = GetComponent <Collider>(); imageColl = transform.GetChild(0).GetComponent <Collider>(); //terminal = GameObject.Find("Terminal"); terminalScript = GetComponentInParent <TerminalScript>(); //terminal.GetComponent<TerminalScript>(); offPosition = transform.localPosition; offPosition.z = -0.7793f; onPosition = transform.localPosition; onPosition.z = -0.5742f; depressedPosition = transform.localPosition; depressedPosition.z = -0.5195f; initSpeed = speed; if (terminalScript.terminalOn) { transform.localPosition = onPosition; off = false; } else { transform.localPosition = offPosition; off = true; } }
public void setBuildTarget(TerminalScript target) { buildTarget = target; }
public void OnCompilePress() { PlaySound(); m_Enemy = hit.collider.GetComponent <EnemyMovement>(); m_EnemyState = hit.collider.GetComponent <StatePatternEnemy>(); if (m_Player.GetComponent <PlayerHealth>().CurrentBp >= m_CompileCost) { m_Player.GetComponent <PlayerHealth>().CurrentBp -= m_CompileCost; //Change string to bool if (m_Agressiveness.text == "True" || m_Agressiveness.text == "true") { isAgro = true; } else if (m_Agressiveness.text == "False" || m_Agressiveness.text == "false") { isAgro = false; } //Change Damage of the targeted enemy m_EnemyState.attackDamage = System.Int32.Parse(m_AttackInput.text); //checks if EnemyMovement reference is not null, if it is then use HiddenPathEnemy reference if (m_Enemy == null) { m_HiddenEnemy = hit.collider.GetComponent <HiddenPathEnemy>(); m_HiddenEnemy.m_Health = System.Int32.Parse(m_HealthInput.text); } else { m_Enemy.m_Health = System.Int32.Parse(m_HealthInput.text); } //Change enemy status if (isAgro == false) { m_EnemyState.currentState = m_EnemyState.passiveState; } if (m_DurationInput.text != "") { m_EnemyState.duration = float.Parse(m_DurationInput.text); } //Normalization of enemy via UI changing wcereb values and matching it with the original if (m_CerebText.text == m_CerebInput.text) { m_Terminal = FindObjectOfType(typeof(TerminalScript)) as TerminalScript; if (m_Terminal != null && m_Terminal.isActiveAndEnabled) { m_Terminal.GetComponent <TerminalScript>().m_Saved++; //Only add if terminal is found m_Terminal.GetComponent <TerminalScript>().m_TotalCount--; } hit.collider.GetComponent <CapsuleCollider>().enabled = false; m_EnemyState.currentState = m_EnemyState.neutralState; } //reset enemy and player scripts hit.collider.GetComponentInChildren <SphereCollider>().enabled = true; hit.collider.GetComponent <Animator>().enabled = true; hit.collider.GetComponent <StatePatternEnemy>().enabled = true; m_Player.GetComponent <PlayerMovement>().DisableMove = false; m_AttackText.text = m_EnemyState.attackDamage.ToString(); //checks if EnemyMovement reference is not null, if it is then use HiddenPathEnemy reference if (m_Enemy == null) { m_HiddenEnemy = hit.collider.GetComponent <HiddenPathEnemy>(); m_HPText.text = m_HiddenEnemy.m_Health.ToString(); m_AgroText.text = m_HiddenEnemy.isAggressive.ToString(); m_DurationText.text = m_HiddenEnemy.Duration.ToString(); m_CerebText.text = m_HiddenEnemy.m_Cereb.ToString(); } else { m_HPText.text = m_Enemy.m_Health.ToString(); m_AgroText.text = m_Enemy.isAggressive.ToString(); m_DurationText.text = m_Enemy.Duration.ToString(); m_CerebText.text = m_Enemy.m_Cereb.ToString(); } CloseDebugger(); CloseOutput(); } }