public static void SetUpBoard() { if (isMultiplayer) { InitializeQuestions(); } InitializeGameEvents(); GameObject[] steps = GameObject.FindGameObjectsWithTag("platform"); foreach (GameObject st in steps) { int i = int.Parse(st.GetComponent <TextMeshPro>().text); MyStep newStep = new MyStep(st.transform.position, i); // TODO: Find a better way to implement questions if (isMultiplayer) { if (i == 3 || i == 5 || i == 25 || i == 27 || i == 29 || i == 23 || i == 42 || i == 39 || i == 10 || i == 21 || i == 46 || i == 11 || i == 37 || i == 33 || i == 17 || i == 15) { int rnumber = Mathf.FloorToInt(UnityEngine.Random.Range(0, 2)); newStep.Question = QUESTION_LIST[rnumber]; } } if (i == 4 || i == 8 || i == 40 || i == 41 || i == 31 || i == 9 || i == 47 || i == 34 || i == 13 || i == 19 || i == 16) { int rnumber = Mathf.FloorToInt(UnityEngine.Random.Range(0, 2)); newStep.GameEvent = GAME_EVENTS_LIST[rnumber]; } stepList.Add(newStep); } }
public void MoveToStep(int newStep) { Vector3 newPosition = new Vector3(); MyStep st = Board.GetStepFromIndex(newStep); newPosition = st.Position; switch (enemyPosition) { case "topright": { newPosition.x += 6f; break; } case "botleft": { newPosition.z -= 6f; break; } case "botright": { newPosition.x += 6f; newPosition.z -= 6f; break; } } transform.position = newPosition; step = newStep; // TODO :fix issue // CheckIfQuestion(); // CheckIfEvent(); }
public void should_assign_output() { Expression <Func <MyData, int> > memberExpr = (x => x.Value1); Expression <Func <MyStep, int> > valueExpr = (x => x.Value1); var subject = new MemberMapParameter(valueExpr, memberExpr); var data = new MyData(); var step = new MyStep { Value1 = 5 }; subject.AssignOutput(data, step, new StepExecutionContext()); data.Value1.Should().Be(step.Value1); }
private SsmData GetSsmData(PfcExecutionContext pfcec) { if (MyStep.Equals(pfcec.Step)) { pfcec = (PfcExecutionContext)pfcec.Parent; } if (!pfcec.Contains(this)) { SsmData retval = new SsmData(); pfcec.Add(this, retval); } return((SsmData)pfcec[this]); }
public void should_convert_input() { Expression <Func <MyStep, object> > memberExpr = (x => x.Value2); Expression <Func <MyData, int> > valueExpr = (x => x.Value1); var subject = new MemberMapParameter(valueExpr, memberExpr); var data = new MyData { Value1 = 5 }; var step = new MyStep(); subject.AssignInput(data, step, new StepExecutionContext()); step.Value2.Should().Be(data.Value1); }
private IEnumerator Move(int step, int newStep) { Vector3 newPosition = new Vector3(0, 0, 0); // When the enemy goes back if (step > newStep) { for (int i = step; i > newStep - 1; i--) { MyStep st = Board.GetStepFromIndex(i); newPosition = st.Position; newPosition.x += 6f; transform.position = newPosition; yield return(new WaitForSeconds(0.2f)); } } else { for (int i = step; i < newStep + 1; i++) { if (i == 49) { Debug.Log("telos"); // Finished game Enemy is the winner // Show something EndGame(); yield break; } MyStep st = Board.GetStepFromIndex(i); newPosition = st.Position; newPosition.x += 6f; transform.position = newPosition; yield return(new WaitForSeconds(0.2f)); } } startingStep = newStep; Dice.isRolling = CheckIfEvent(); if (!Dice.isRolling) { // Enemy finished moving Dice.turn = "player"; } }
private IEnumerator Move(int step, int newStep) { Vector3 newPosition = new Vector3(0, 0, 0); // When the player goes back if (step > newStep) { for (int i = step; i > newStep - 1; i--) { MyStep st = Board.GetStepFromIndex(i); newPosition = st.Position; switch (playerPosition) { case "topright": { newPosition.x += 6f; break; } case "botleft": { newPosition.y -= 5f; break; } case "botright": { newPosition.x += 6f; newPosition.y -= 5f; break; } } transform.position = newPosition; // Play sound GameObject.FindGameObjectWithTag("soundEffects").GetComponent <SoundEffects>().PlaySoundEffect(moveSound); yield return(new WaitForSeconds(0.2f)); } } else { for (int i = step; i < newStep + 1; i++) { MyStep st = Board.GetStepFromIndex(i); newPosition = st.Position; switch (playerPosition) { case "topright": { newPosition.x += 6f; break; } case "botleft": { newPosition.y -= 5f; break; } case "botright": { newPosition.x += 6f; newPosition.y -= 5f; break; } } transform.position = newPosition; // Play sound GameObject.FindGameObjectWithTag("soundEffects").GetComponent <SoundEffects>().PlaySoundEffect(moveSound); if (i == 49) { Debug.Log("telos"); // Finished game Player is the winner // Show something EndGame(); yield break; } yield return(new WaitForSeconds(0.2f)); } } // Let player roll a dice again Startingstep = newStep; checkIfQuestion(); checkIfEvent(); if (!checkIfQuestion() && !checkIfEvent()) { Dice.turn = "enemy"; enemy.RollDiceForEnemy(); } }