// Use this for initialization public void InitiliazeDisplay(CONTROLS playerSide) { GameObject display; switch (playerSide) { case CONTROLS.LEFT: display = GameObject.Find("PanContentsLeft"); panDisplayIcons = display.GetComponentsInChildren <RawImage>(); panDisplayOutline = display.GetComponentsInChildren <Outline>(); break; case CONTROLS.RIGHT: display = GameObject.Find("PanContentsRight"); panDisplayIcons = display.GetComponentsInChildren <RawImage>(); panDisplayOutline = display.GetComponentsInChildren <Outline>(); break; } originalColor = panDisplayOutline[0].effectColor; ClearDisplay(); foreach (Outline outline in panDisplayOutline) { outline.effectColor = Color.clear; } }
void HandleUserControls(CONTROLS control){ if(controlMode == CONTROLS.FP){ HandleFirstPersonControls(); } else if(controlMode == CONTROLS.TP){ HandleThirdPersonControls(); } }
public int EvaluatePanContent(List <GameObject> panContent, CONTROLS pan) { if (IsRecipeCompleted(panContent, true, pan)) { difficultyLevel++; GenerateRecipe(); return(recipeBonusPoints); } return(0); }
void ScriptInitialization() { if (transform.parent.position.x > 0) { playerSide = CONTROLS.RIGHT; } else { playerSide = CONTROLS.LEFT; } }
// Use this for initialization void Start() { if (transform.position.x < 0) { side = CONTROLS.LEFT; stoveTopButton = "StoveTopLeft"; } else { side = CONTROLS.RIGHT; stoveTopButton = "StoveTopRight"; } audioSource = GetComponent <AudioSource>(); audioSource.clip = validationSound; flame = GetComponentInChildren <ParticleSystem>(); }
KeyCode GetPlayerKey(CONTROLS requestedControl) { switch (requestedControl) { case CONTROLS.LEFT: { if (playerIndex == 1) { return(KeyCode.A); } if (playerIndex == 2) { return(KeyCode.LeftArrow); } break; } case CONTROLS.RIGHT: { if (playerIndex == 1) { return(KeyCode.D); } if (playerIndex == 2) { return(KeyCode.RightArrow); } break; } case CONTROLS.JUMP: { if (playerIndex == 1) { return(KeyCode.Space); } if (playerIndex == 2) { return(KeyCode.Keypad0); } break; } } // Default return. return(KeyCode.RightWindows); }
// Set up movement controls for the players float GetPlayerKey(CONTROLS requestedControls) { switch (requestedControls) { case CONTROLS.WALK: { return(Input.GetAxis(controllerPrefix + "Horizontal")); } case CONTROLS.JUMP: { return(Input.GetAxis(controllerPrefix + "Jump")); } case CONTROLS.BLOCK: { return(Input.GetAxis(controllerPrefix + "Block")); } } return(0.0f); }
public void AddScore(CONTROLS side, int points) { switch (side) { case CONTROLS.LEFT: leftScore += points; roundLeftScore += points; overallLeftScore += points; Instantiate(MovingScore, Camera.main.WorldToScreenPoint(GameObject.Find("Player1").transform.position), Quaternion.identity, GameObject.Find("UI").transform).GetComponent <MovingScore>().SendOff(displayLeftScore.transform, points); break; case CONTROLS.RIGHT: rightScore += points; roundRightScore += points; overallRightScore += points; Instantiate(MovingScore, Camera.main.WorldToScreenPoint(GameObject.Find("Player2").transform.position), Quaternion.identity, GameObject.Find("UI").transform).GetComponent <MovingScore>().SendOff(displayRightScore.transform, points); break; default: Debug.LogWarning("There are 2 sides to the scoreboard, left and right!"); break; } }
// Use this for initialization void Start() { posSamples = new List <Vector3>(); rollSample = new List <Vector2>(); while (posSamples.Count < JitterFilterSampleCount) { posSamples.Add(Vector3.zero); rollSample.Add(Vector2.zero); } rb = GetComponent <Rigidbody>(); if (rb.position.x < 0) { player = CONTROLS.LEFT; Controller = GameObject.FindGameObjectWithTag("LeftController"); } else { player = CONTROLS.RIGHT; Controller = GameObject.FindGameObjectWithTag("RightController"); } keyboardPosition.y = transform.position.y; keyboardPosition.z = transform.position.z; //MoveSetup.instance.onStart += StartMovement; }
public override void RestructControl() { COUNT_LABEL = 2; COUNT_TG_IN_COLUMN = 3; COL_TG_START = 5; COUNT_ROW_LABELCOMMON = 1; bool bPowerFactZoom = false; int cntCols = 0; TableLayoutPanelCellPosition pos; //Удаление ОБЩих элементов управления // температуры removeFirstCommonLabels((int)CONTROLS.lblTemperatureDateValue); ////??? мощности //removeSecondCommonLabels((int)CONTROLS.lblPowerHourValue); //Удаление ПУСТой панели if (!(this.Controls.IndexOf(m_panelEmpty) < 0)) { this.Controls.Remove(m_panelEmpty); } else { ; } //Удаление стилей столбцов while (this.ColumnStyles.Count > 1) { this.ColumnStyles.RemoveAt(this.ColumnStyles.Count - 1); } ////??? отображается ли Мощность (Отклонения) - для текущей вкладки неактуально //COL_TG_START -= 2; // вне ~ от контекстного меню, т.к. контекстного меню нет ////??? отображается ли ТМ - для текущей вкладки неактуально //COUNT_LABEL--; // вне ~ от контекстного меню, т.к. контекстного меню нет //COL_TG_START--; // отображение ТМ для этой вкладки не предусмотрено #region Температура for (CONTROLS i = (CONTROLS)m_indxStartCommonFirstValueSeries; i < CONTROLS.lblTemperatureDateValue + 1; i++) { //this.Controls.Add(m_arLabelCommon[(int)i - m_indxStartCommonPVal]); this.Controls.Add(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries]); pos = getPositionCell((int)i); this.SetCellPosition(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries], pos); //this.SetRowSpan(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries], COUNT_ROW_LABELCOMMON); } //Ширина столбцов группы "Температура" SZ_COLUMN_LABEL = 48F; /*SZ_COLUMN_LABEL_VALUE = 78F;*/ this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_LABEL)); this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_LABEL_VALUE)); #endregion #region Отклонение for (CONTROLS i = (CONTROLS)m_indxStartCommonSecondValueSeries; i < CONTROLS.lblDeviatDateValue + 1; i++) { //this.Controls.Add(m_arLabelCommon[(int)i - m_indxStartCommonPVal]); this.Controls.Add(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries]); this.SetCellPosition(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries], getPositionCell((int)i)); //this.SetRowSpan(this.m_arLabelCommon[(int)i - m_indxStartCommonFirstValueSeries], COUNT_ROW_LABELCOMMON); } //Ширина столбцов группы "Отклонение" SZ_COLUMN_LABEL = 63F; /*SZ_COLUMN_LABEL_VALUE = 78F;*/ this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_LABEL)); this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_LABEL_VALUE)); #endregion cntCols = ((m_tgLabels.Count / COUNT_TG_IN_COLUMN) + ((m_tgLabels.Count % COUNT_TG_IN_COLUMN == 0) ? 0 : 1)); for (int i = 0; i < cntCols; i++) { this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_TG_LABEL)); this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, SZ_COLUMN_TG_LABEL_VALUE)); } //if (m_tgLabels.Count > 0) // addTGLabels(false); //else // ; this.Controls.Add(m_panelEmpty, COL_TG_START + cntCols * COUNT_LABEL + (bPowerFactZoom == true ? 1 : 0), 0); this.SetRowSpan(m_panelEmpty, COUNT_ROWS); this.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); }
private void InitializeComponents() { COUNT_ROWS = 3; // значение 'SZ_COLUMN_LABEL' устанавливается индивидуально /*SZ_COLUMN_LABEL = 48F;*/ SZ_COLUMN_LABEL_VALUE = 78F; SZ_COLUMN_TG_LABEL = 40F; SZ_COLUMN_TG_LABEL_VALUE = 75F; m_indxStartCommonFirstValueSeries = (int)CONTROLS.lblTemperatureCurrent; m_indxStartCommonSecondValueSeries = (int)CONTROLS.lblDeviatCurrent; m_iCountCommonLabels = (int)CONTROLS.lblDeviatDateValue - (int)CONTROLS.lblTemperatureCurrent + 1; // количество и параметры строк макета панели this.RowCount = COUNT_ROWS; for (int i = 0; i < this.RowCount + 1; i++) { this.RowStyles.Add(new RowStyle(SizeType.Percent, (float)Math.Round((float)100 / this.RowCount, 1))); } this.m_arLabelCommon = new System.Windows.Forms.Label[m_iCountCommonLabels]; // // btnSetNow // this.Controls.Add(this.btnSetNow, 0, 0); // // dtprDate // this.Controls.Add(this.dtprDate, 0, 1); // // lblServerTime // this.Controls.Add(this.lblServerTime, 0, 2); //Ширина столбца группы "Элементы управления" this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100F)); //Создание ОБЩих элементов управления Color foreColor, backClolor; float szFont; ContentAlignment align; string text = string.Empty; #region добавить поля для значений ТЕМПЕРАТУРЫ и их подписи for (CONTROLS i = (CONTROLS)m_indxStartCommonFirstValueSeries; i < CONTROLS.lblTemperatureDateValue + 1; i++) { //szFont = 6F; switch (i) { case CONTROLS.lblTemperatureCurrent: case CONTROLS.lblTemperatureHour: case CONTROLS.lblTemperatureDate: foreColor = Color.Black; backClolor = Color.Empty; szFont = 8F; align = ContentAlignment.MiddleLeft; break; case CONTROLS.lblTemperatureCurrentValue: case CONTROLS.lblTemperatureHourValue: case CONTROLS.lblTemperatureDateValue: foreColor = Color.LimeGreen; backClolor = Color.Black; szFont = 15F; align = ContentAlignment.MiddleCenter; break; default: foreColor = Color.Yellow; backClolor = Color.Red; szFont = 6F; align = ContentAlignment.MiddleCenter; break; } switch (i) { case CONTROLS.lblTemperatureCurrent: text = @"t тек"; break; case CONTROLS.lblTemperatureHour: text = @"t час"; break; case CONTROLS.lblTemperatureDate: text = @"t сут"; break; default: text = string.Empty; break; } createLabel((int)i, text, foreColor, backClolor, szFont, align); } #endregion #region добавить поля для значений отклонения и их подписи for (CONTROLS i = (CONTROLS)m_indxStartCommonSecondValueSeries; i < CONTROLS.lblDeviatDateValue + 1; i++) { switch (i) { case CONTROLS.lblDeviatCurrent: case CONTROLS.lblDeviatHour: case CONTROLS.lblDeviatDate: foreColor = Color.Black; backClolor = Color.Empty; szFont = 8F; align = ContentAlignment.MiddleLeft; break; case CONTROLS.lblDeviatCurrentValue: case CONTROLS.lblDeviatHourValue: case CONTROLS.lblDeviatDateValue: foreColor = Color.LimeGreen; backClolor = Color.Black; szFont = 15F; align = ContentAlignment.MiddleCenter; break; default: foreColor = Color.Yellow; backClolor = Color.Red; szFont = 6F; align = ContentAlignment.MiddleCenter; break; } switch (i) { case CONTROLS.lblDeviatCurrent: text = @"Откл.тек"; break; case CONTROLS.lblDeviatHour: text = @"Откл.час"; break; case CONTROLS.lblDeviatDate: text = @"Откл.сут"; break; default: text = string.Empty; break; } createLabel((int)i, text, foreColor, backClolor, szFont, align); } #endregion }
void SetUIMode(CONTROLS control){ if(control == CONTROLS.FP){ fpUI.SetActive(true); } else if( control == CONTROLS.TP){ fpUI.SetActive(false); } }
void SetControlMode(CONTROLS control){ if(control == CONTROLS.FP){ controlMode = CONTROLS.FP; fpCamera.enabled = true; tpCamera.enabled = false; Cursor.visible = false; navMeshAgent.enabled = false; } else if(control == CONTROLS.TP){ controlMode = CONTROLS.TP; tpCamera.enabled = true; fpCamera.enabled = false; Cursor.visible = true; StartCoroutine(WaitForGroundToEnableNavMesh()); } }
public void React(bool success, int positives, int negatives, CONTROLS pan) { if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Idle")) { return; } if (!success && positives == 0 && negatives == 0) { return; } Reaction reaction = Reaction.Ok; if (success) { if (positives > 0 && negatives == 0) { reaction = Reaction.Great; } if (positives == 0 && negatives == 0) { reaction = Reaction.Clean; } //Excellent makes no sense } else { if (positives < 4) { reaction = Reaction.NotGood; } if (negatives > 0) { reaction = Reaction.Bad; } if (negatives > 1 || positives == 0) { reaction = Reaction.Awful; } } if (pan == CONTROLS.LEFT) { speechBubbleLeft.SetActive(true); speechBubbleRight.SetActive(false); animator.SetBool("Left", true); } else { speechBubbleLeft.SetActive(false); speechBubbleRight.SetActive(true); animator.SetBool("Left", false); } switch (reaction) { case Reaction.Ok: animator.SetTrigger("OK"); break; case Reaction.Great: animator.SetTrigger("Yum"); break; case Reaction.Excellent: animator.SetTrigger("Delicious"); break; case Reaction.Clean: //Excellent is inactive and there is no react for clean animator.SetTrigger("Delicious"); break; case Reaction.NotGood: animator.SetTrigger("Bland"); break; case Reaction.Bad: animator.SetTrigger("Tasteless"); break; case Reaction.Awful: animator.SetTrigger("Disgraceful"); break; default: Debug.LogWarning("Something went horrendously wrong in ChefReacting.cs"); break; } animator.SetTrigger("React"); }
private bool IsRecipeCompleted(List <GameObject> panContents, bool isDelivery, CONTROLS pan = CONTROLS.LEFT) { List <RecipeItem> adjustedPanContents = new List <RecipeItem>(); List <GameObject> tempPanContents = new List <GameObject>(panContents); int surplusPositives = 0; int negatives = 0; // The 2 null safe guards below are in place because of 1 single issue: // When the player pans overlapt, the ingredient is added to both panContents list. If however one of the players happens to be // above their stove at the time, this ingredient's gameobject will be destroyed and deleted from one of the lists but not the other. // In other words, the safeguards protect against analyzing ingredient that no longer exist. //int count = 0; while (tempPanContents.Count > 0) { GameObject foodType = tempPanContents[0]; //Debug.Log("Current foodtype " + foodType.GetComponent<Food>().GetName()); if (foodType == null) { tempPanContents.Remove(foodType); continue; } Food food = foodType.GetComponent <Food>(); int foodQuantity = 0; for (int i = 0; i < tempPanContents.Count; i++) { if (tempPanContents == null) { tempPanContents.Remove(tempPanContents[i]); i--; continue; } else if (tempPanContents[i].GetComponent <Food>().GetID() == food.GetID()) { foodQuantity++; } } adjustedPanContents.Add(new RecipeItem(tempPanContents[0], foodQuantity)); //Debug.Log("Found " + foodQuantity.Count + " " + foodType.GetComponent<Food>().GetName()); //Debug.Log("Added " + adjustedPanContents[count].quantity + " " + adjustedPanContents[count].ingredient.GetComponent<Food>().GetName()); //Debug.Log(adjustedPanContents.Count); //count++; for (int i = 0; i < tempPanContents.Count; i++) { if (tempPanContents[i].GetComponent <Food>().GetID() == food.GetID()) { tempPanContents.RemoveAt(i); i--; } } } // Suggested by Tommi - Not working either //int count = 0; //foreach (RecipeItem required in recipe) //{ // Food outer = required.ingredient.GetComponent<Food>(); // foreach (RecipeItem have in adjustedPanContents) // { // Food inner = have.ingredient.GetComponent<Food>(); // if (outer.GetID() == inner.GetID() && have.quantity >= required.quantity) // { // count++; // continue; // } // } //} //Debug.Log(count == recipe.Count); //if (count == recipe.Count) // return true; //return false; bool recipeComplete = true; List <int> InRecipe = new List <int>(); for (int i = 0; i < recipe.Count; i++) { bool foundItemInPan = false; int foodQ = 0; for (int j = 0; j < adjustedPanContents.Count; j++) { if (adjustedPanContents[j].ingredient == null)//could this happen? { continue; } if (adjustedPanContents[j].ingredient.GetComponent <Food>().GetID() == recipe[i].ingredient.GetComponent <Food>().GetID()) { foundItemInPan = true; foodQ = adjustedPanContents[j].quantity; InRecipe.Add(j); break; } } if (foundItemInPan && recipe[i].EnoughQ(foodQ)) { continue; } recipeComplete = false; } if (isDelivery) { for (int i = 0; i < adjustedPanContents.Count; i++) { if (recipeComplete && InRecipe.Contains(i)) { continue; } if (adjustedPanContents[i].ingredient.GetComponent <Food>().GetPointValue() < 0) { negatives++; } else { surplusPositives++; } } ChefReacting.instance.React(recipeComplete, surplusPositives, negatives, pan); } return(recipeComplete); }