Пример #1
0
 private void SetByteArrayExpOutput()
 {
     mState = ExpState.ByteArray;
     SetIntText(GetStartIntValueFromBuffer());
     ByteArrayString = mCodePage.GetString(ExpHepler.ByteArrayBuffer, 0, mByteArrayBufferCount);
     ExpOutputChanged?.Invoke(this, mState);
 }
Пример #2
0
 public void resetPlayerData()
 {
     level            = 0;
     bugsEaten        = 0;
     bugsEatenLog     = new List <float> ();
     expState         = ExpState.Living;
     sessionStartTime = Time.time;
 }
Пример #3
0
 public PlayerData()
 {
     level            = 0;
     bugsEatenLog     = new List <float> ();
     expState         = ExpState.Living;
     sessionStartTime = Time.time;
     zoneName         = "nowhere";
 }
Пример #4
0
 public void RemoveAct(ExpState newState)
 {
     if (currentAct != null)
     {
         society.DecInteractor();
         currentAct = null;
         state      = newState;
     }
 }
Пример #5
0
 public void addBugEaten()
 {
     bugsEaten++;
     bugsEatenLog.Add(Time.time);
     if (expState == ExpState.Warn)
     {
         expState = ExpState.Living;
     }
 }
Пример #6
0
 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);
 }
Пример #7
0
 private void SetConstOutput(Int64 value)
 {
     mState = ExpState.Exp;
     SetIntText(value);
     unsafe
     {
         ByteArrayString = ByteArrayToHexString((Byte *)&value, 8);
     }
     ExpOutputChanged?.Invoke(this, mState);
 }
Пример #8
0
    /// <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);
            }
        }
    }
Пример #9
0
        void Start()
        {
            Application.targetFrameRate = 120;
            expState  = ExpState.Account;
            taskState = TaskState.Free;

            if (Routines.Count != 7)
            {
                Debug.Log("Not enough routine");
                return;
            }
        }
Пример #10
0
 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);
     }
 }
Пример #11
0
    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);
        }
    }
Пример #12
0
    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();
    }
Пример #13
0
 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);
 }
Пример #14
0
    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();
    }
Пример #15
0
 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;
         }
     }
 }
Пример #16
0
    /// <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));
            }
        }
    }