public void open(chest ch) { if (UI.screen == UiManager.onScreen.nothing) { StartCoroutine(openChest(ch)); } }
int isRightBlocked() { Vector2 position = transform.position; Vector2 rightdir = (Vector2.right) * 1f; float distance = 1f; Debug.DrawRay(position, rightdir, Color.red); RaycastHit2D block = Physics2D.Raycast(position, rightdir, distance, wall); RaycastHit2D inter = Physics2D.Raycast(position, rightdir, distance, interactable); RaycastHit2D baddy = Physics2D.Raycast(position, rightdir, distance, enemy); if (block) { //Debug.Log("1R"); return(1); } if (inter) { //Debug.Log(inter.collider.name); ctarg = inter.collider.GetComponent <chest>(); htarg = inter.collider.GetComponent <hpickup>(); return(2); } if (baddy) { targ = baddy.collider.GetComponent <mindlessAI>(); return(3); } return(0); }
IEnumerator closeChest() { showedUp = false; chestPanel.SetActive(false); actualChest.anim.SetTrigger("close"); yield return(new WaitForSeconds(1.3f)); pC.movementAndLookEnabled = true; pC.mouseVisibleAndUnlocked = false; itemsUpdate(); UI.screen = UiManager.onScreen.nothing; actualChest = null; }
IEnumerator openChest(chest ch) { UI.screen = UiManager.onScreen.chest; pC.movementAndLookEnabled = false; pC.mouseVisibleAndUnlocked = true; actualChest = ch; ch.anim.SetTrigger("open"); //play sound of opening chest yield return(new WaitForSeconds(1.3f)); chestPanel.SetActive(true); showedUp = true; itemsInChestClear(); assignItems(); }
//check chest bool chestMenu(chest currentPlace, playerToken currentPlayer) { //pay or gain int tempNum = currentPlace.RentPrice(); if (tempNum < 0) { //PAY if (currentPlayer.money > (tempNum * -1)) { desc = "PAY " + tempNum; if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .1f, Screen.width * .3f, Screen.height * .1f), "PAY")) { VariableManager.tax -= tempNum; currentPlayer.money += tempNum; return(true); VariableManager.turn = 2; } } //sell if (currentPlayer.places.Count > 0) { if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .4f, Screen.width * .2f, Screen.height * .1f), "SELL")) { this.yourArray = new List <bool> (currentPlayer.places.Count); this.offSet = 0; VariableManager.turn = 5; } } //surrender if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .5f, Screen.width * .2f, Screen.height * .1f), "SURRENDER")) { currentPlayer.surrender(); VariableManager.turn = 0; } } else { //GAIN currentPlayer.money += tempNum; desc = "GAIN " + tempNum; VariableManager.turn = 2; return(true); } return(false); //end turn }
private void button2_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); chest found = new chest(); foreach (chest ch in g.maze.chests) { if (ch.y_coord == g.pl.x_coord && ch.x_coord == g.pl.y_coord) { found = ch; break; } } //высвободить содержимое if (found.it.is_key) { g.pl.has_key = true; sb.Append(Environment.NewLine + "Это ключ, проход к след. уровню открыт"); } else { g.pl.stuffs.Insert(0, found.it); label4.Text = "Стоит " + g.pl.stuffs[0].costs + "\n восстанавливает " + g.pl.stuffs[0].hp_restore; button3.Enabled = true; //comboBox1.DataSource = g.pl.stuffs; //comboBox1.DisplayMember = "costs"; sb.Append(Environment.NewLine + "Вы нашли ..., стоит " + found.it.costs); } lab_updt(label1, label2, label3); // comboBox1.DisplayMember = "hp_restore"; textBox1.Text = textBox1.Text + sb.ToString(); combat(found.m); lab[g.pl.y_coord, g.pl.x_coord] = 1; g.maze.chests.Remove(found); button2.Enabled = false; button2.Visible = false; }
return(new ChestContainer(chest, location, tile, this.Reflection));
return(new ChestContainer(chest, location, tile));
public void SetChest(chest chest, GameObject chestObject) { _chest = chest; _enemyObject = chestObject; }