private void SetByteArrayExpOutput() { mState = ExpState.ByteArray; SetIntText(GetStartIntValueFromBuffer()); ByteArrayString = mCodePage.GetString(ExpHepler.ByteArrayBuffer, 0, mByteArrayBufferCount); ExpOutputChanged?.Invoke(this, mState); }
public void resetPlayerData() { level = 0; bugsEaten = 0; bugsEatenLog = new List <float> (); expState = ExpState.Living; sessionStartTime = Time.time; }
public PlayerData() { level = 0; bugsEatenLog = new List <float> (); expState = ExpState.Living; sessionStartTime = Time.time; zoneName = "nowhere"; }
public void RemoveAct(ExpState newState) { if (currentAct != null) { society.DecInteractor(); currentAct = null; state = newState; } }
public void addBugEaten() { bugsEaten++; bugsEatenLog.Add(Time.time); if (expState == ExpState.Warn) { expState = ExpState.Living; } }
private void SetError(ExpType reason) { mState = ExpState.Error; UnsignedDecString = String.Empty; SingedDecString = String.Empty; HexString = String.Empty; BinString = String.Empty; ByteArrayString = reason.ToString(); ExpOutputChanged?.Invoke(this, mState); }
private void SetConstOutput(Int64 value) { mState = ExpState.Exp; SetIntText(value); unsafe { ByteArrayString = ByteArrayToHexString((Byte *)&value, 8); } ExpOutputChanged?.Invoke(this, mState); }
/// <summary> /// Spawns a new ball based on the 30 balls of the experiment list. /// </summary> private IEnumerator SpawnBall() { if (!canPressStartButton && playerReady) //Double check to present sending two balls in transition { if (past6Min) { FinishExp(); } _currBallType = _expList.Current; _currBallNumber++; ballAndPosText.text = "Ball: " + _currBallNumber + " Pos: " + _currBallType + " Level: " + playerLevel; bool isNewBallAvail = _expList.MoveNext(); if (!isNewBallAvail) { FinishExp(); yield break; } _currBallPath = ballPositions[_currBallType]; if (IsAnnounceBall) { if (playerLevel == 0) { yield return(AnnounceBallPos(HintLength.full)); } if (playerLevel == 1) { yield return(AnnounceBallPos(HintLength.shortLen)); } if (playerLevel == 2) { yield return(AnnounceBallPos(HintLength.nonspatial)); } } if (!canPressStartButton && playerReady) //Check again to not send ball in transition. { firstPass = true; _currentBall = Instantiate(ourBall, _currBallPath.Origin, new Quaternion()); expState = ExpState.ballInPlay; Rigidbody rb = _currentBall.GetComponent <Rigidbody>(); _currBallSpeed = DetermineCurrBallSpeed(); //Play Click sound _currentBall.GetComponents <AudioSource>()[1].Play(); rb.AddForce(ballPositions[_currBallType].Destination * _currBallSpeed, ForceMode.Acceleration); } } }
void Start() { Application.targetFrameRate = 120; expState = ExpState.Account; taskState = TaskState.Free; if (Routines.Count != 7) { Debug.Log("Not enough routine"); return; } }
private void SetToEmpty() { if (mState != ExpState.Ignore) { mState = ExpState.Ignore; SingedDecString = String.Empty; UnsignedDecString = String.Empty; HexString = String.Empty; BinString = String.Empty; ByteArrayString = String.Empty; ExpOutputChanged?.Invoke(this, mState); } }
public void SetState(ExpState es) { state = es; if (state == ExpState.Editing) { dna.MakeVisibleAndInteractive(true, true); } else if (state == ExpState.Showing) { dna.MakeVisibleAndInteractive(true, false); } else { dna.MakeVisibleAndInteractive(false, false); } }
private void Update() { GameUtils.playState = GameUtils.GamePlayState.ExpMode; if (TactileAndAudio) { IsTactileDouse = true; IsMidPointAnnounce = true; } else { IsTactileDouse = false; IsMidPointAnnounce = true; } clockText.text = clockString; //Check ball state //DEBUG ONLY //if(true) //END DEBUG //Wait for player initalization if (!playerReady) { batSound.mute = true; if (JoyconController.ButtonPressed) { playerReady = true; PaddleScript.TableEdge = BodySourceView.baseKinectPosition.Z; PaddleScript.CenterX = BodySourceView.baseKinectPosition.X; } } else { Time.timeScale = 1; BallScript.GameInit = false; batSound.mute = false; expState = ExpState.noBall; } CheckHitResult(); SetGameHints(); }
private void SetStringExpOutput() { mByteArrayBufferCount = mCodePage.GetBytes(this.Text, 2, this.Text.Length - 2, ExpHepler.ByteArrayBuffer, 0); if (mByteArrayBufferCount == 0) { SetToEmpty(); return; } SetIntText(GetStartIntValueFromBuffer()); unsafe { fixed(Byte *pByte = ExpHepler.ByteArrayBuffer) { ByteArrayString = ByteArrayToHexString(pByte, mByteArrayBufferCount); } } mState = ExpState.String; ExpOutputChanged?.Invoke(this, mState); }
private void Start() { if (JoyconManager.Instance == null) { SceneManager.LoadSceneAsync("GlobalInit", LoadSceneMode.Single); return; } GameUtils.playState = GameUtils.GamePlayState.ExpMode; GameUtils.ballSpeedPointsEnabled = false; _currBallNumber = -1; CreateBallPosition(); ShuffleArray(); saveExpButton.onClick.AddListener(FinishExp); startExpButton.onClick.AddListener(StartExp); numberSpeech = globalSpeechGameObject.GetComponent <NumberSpeech>(); _audioSources = GetComponents <AudioSource>(); levelUpAudio = _audioSources[14]; BallScript.GameInit = false; playerReady = false; batSound = batObj.GetComponents <AudioSource>()[0]; batSound.mute = true; StartCoroutine(GameUtils.PlayIntroMusic()); newBallOk = true; canPressButton = true; clockTimer = new Timer(100); clockTimer.Elapsed += ClockTimer_Elapsed; globalTimer = new Timer(100); globalTimer.Elapsed += GlobalTimer_Elapsed; globalTimer.Start(); ExperimentLog.Log("Program Started", time: DateTime.Now.ToLongTimeString()); gamePoints = 0; canPressStartButton = true; expState = ExpState.menus; playerLevel = 0; past6Min = false; prevHits = new int[6] { 0, 0, 0, 0, 0, 0 }; SetupChildAudio(); }
void Update() { if (Routines.Count != 7) { return; } if (Routines[(int)expState].UpdateRoutine()) { if (!isPractice && expState == ExpState.Account) { expState = ExpState.TaskStart; } else if (expState == ExpState.PracticeFinish && isPractice) { expState = ExpState.PracticeFinish; } else { expState = expState + 1; } } }
/// <summary> /// Checks the results of the ball if it was hit or not. /// </summary> private void CheckHitResult() { //Perfect hit, start new ball if ((BallScript.BallHitOnce) && maxDistance > 10) { timerStarted = false; StartCoroutine(HitPastHalfStartNextBall()); return; } //Ball Falls in goal, start new ball if (GoalScript.ExpBallLose) { GoalScript.ExpBallLose = false; if (BallScript.BallHitOnce) { StartNextBall(HitRes.tipped); } else { StartNextBall(HitRes.miss); } return; } if (GoalScript.ExpBallWin) { GoalScript.ExpBallWin = false; StartNextBall(HitRes.goal); return; } //Wait for result of hit if (timerStarted) { if (BallScript.BallHitOnce) { if (_currentBall != null) { if (maxDistance <= _currentBall.transform.position.z) { maxDistance = _currentBall.transform.position.z; } } else { return; } } else { maxDistance = -130; } int timerInterval = IsAnnounceBall ? 10 : 8; if (Time.time > oldTime + timerInterval) { oldTime = Time.time; expState = ExpState.noBall; StartNextBall(DetermineHitRes(_currentBall)); } } }