コード例 #1
0
 private void OnLoadSelectedTrialEvent(object sender, int selectedTrial)
 {
     _sessionIndex = selectedTrial;
     ResetForNextTrial();
     AddScore?.Invoke(sender, _testModeFlag);
     DisposeAudioComponents();
     ConstructMushraComponents();
 }
コード例 #2
0
        private void OnTrialsBtnClicked(object sender, RoutedEventArgs e)
        {
            if (_sessCreatedFlag == false)
            {
                return;
            }

            AddScore?.Invoke(sender, _testModeFlag);

            if (_testModeFlag)
            {
                if (_scorerDetails.ScoreFileName == "")
                {
                    MessageBox.Show("No Score Sheet has found for this session!!! Please create a New Score Sheet for this Session");
                    Log.Write(LogLevel.Warning, "No Score Sheet has found for this session!!! Please create a New Score Sheet for this Session");
                    return;
                }
                if (_scoringSliderFlag == false)
                {
                    PauseAudio();
                    return;
                }
                LogScores();
            }
            ResetForNextTrial();

            DisposeAudioComponents();

            //_doAudioOperations = null;

            var endOfListflag = ConstructMushraComponents();

            if (endOfListflag == false)
            {
                _allTrialsCompleted = true;

                if (_testModeFlag)
                {
                    MessageBox.Show("The Test is Complete");
                    _scoreLogger.CloseFile();
                    ResetAllInAuditionMode();
                    Log.Write(LogLevel.Info, "The Test is Complete");
                }
                else
                {
                    _sessionIndex = 0;
                    ConstructMushraComponents();
                }
                _waveDisplay.ChannelPosition = 0.0;
            }
            else
            {
                _allTrialsCompleted = false;
            }
        }
コード例 #3
0
    virtual protected void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Ball")
        {
            // This isn't an optimal object-oriented solution because Block objects shouldn't really have to
            // know about the existence of the HUD or the methods it exposes, but it's a reasonable solution
            // given the C# knowledge we have at this point.
            // Don't worry, we'll make this much better once we
            // know about delegates and event handling.

            // Finally, we did it better!
            addScore.Invoke(weight);
            Destroy(gameObject);
        }
    }
コード例 #4
0
ファイル: ShootingScript.cs プロジェクト: EvgPn/BallonSniper
    private void MakeShoot(RaycastHit2D hitFromCrosshair)
    {
        if (GetComponent <SpriteRenderer>().color == hitFromCrosshair.collider.gameObject.GetComponent <SpriteRenderer>().color)
        {
            AddScore?.Invoke();
            GameObject popVFX = Instantiate(_poppingVFX, hitFromCrosshair.collider.gameObject.transform.position, Quaternion.identity);
            popVFX.GetComponent <ParticleSystem>().startColor = GetComponent <SpriteRenderer>().color;
            Destroy(popVFX, 0.5f);

            Destroy(hitFromCrosshair.collider.gameObject);
            _balloonsCounter.BalloonsInScene--;
        }
        else
        {
            GetComponent <SpriteRenderer>().color = Color.red;
            StartCoroutine(Blinking(1f, 0.2f));
        }
    }
コード例 #5
0
ファイル: Snake.cs プロジェクト: ChayDealer/JSJA
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.tag == "FoodPrefab")
     {
         _ateFood = true;
         AddScore?.Invoke(col.gameObject.GetComponent <Food>().ScoreValue);
         Destroy(col.gameObject);
     }
     else if (col.tag == "Bonus")
     {
         _ateBonus = true;
         AddScore?.Invoke(col.gameObject.GetComponent <Bonus>().ScoreValue);
         Bonus._isExists = false;
         Destroy(col.gameObject);
     }
     else if (col.tag == "Tail")
     {
         if (curGameState != GameState.Immun)
         {
             LoseGame();
         }
     }
 }
コード例 #6
0
    public void Shoot()
    {
        float x = Input.GetAxis("Mouse X");
        float y = Input.GetAxis("Mouse Y");

        Vector3 mousePos = Input.mousePosition;

        Ray ray = cam.ScreenPointToRay(mousePos);

        Debug.DrawRay(ray.origin, ray.direction * distanceRay, Color.yellow);

        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, distanceRay))
            {
                if (hit.collider.gameObject.tag == "Bomb")
                {
                    hit.collider.gameObject.SetActive(false);
                    AddScore?.Invoke(this);
                }
            }
        }
    }
コード例 #7
0
ファイル: Pipe.cs プロジェクト: ArturMokosa/FlappyBird
        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < qty * 2; i += 2)
            {
                xPos[i / 2] -= speed * (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (xPos[i / 2] < 120 && pipeScored[i / 2] == false)
                {
                    pipeScored[i / 2] = true;
                    AddScore.Invoke();
                }

                if (xPos[i / 2] <= -Width)
                {
                    pipeScored[i / 2] = false;
                    xPos[i / 2]       = -Width + (Width + Span) * (qty * 2);
                    int y = minY + random.Next() % (maxY - minY);
                    destRects[i].Y     = y;
                    destRects[i + 1].Y = y + (int)(distance + Height);
                }

                destRects[i].X     = (int)xPos[i / 2];
                destRects[i + 1].X = (int)xPos[i / 2];
            }
        }
コード例 #8
0
 public void OnTriggerEnter(Collider other)
 {
     SpeedImprove.Invoke(other, _speedBuff);
     AddScore.Invoke(_scorePoints);
     Destroy(gameObject);
 }
コード例 #9
0
 public void OnAsteroidDestroyed(object sender, EventArgs e)
 {
     AddScore?.Invoke(this, new AddScoreEventArgs((sender as Asteroid).DestroyBounty));
 }
コード例 #10
0
 public void OnAsteroidMissed(object sender, EventArgs e)
 {
     AddScore?.Invoke(this, new AddScoreEventArgs(-(sender as Asteroid).MissPenalty));
 }
コード例 #11
0
ファイル: Snake.cs プロジェクト: ChayDealer/JSJA
 private void WinGame()
 {
     curGameState = GameState.Win;
     AddScore?.Invoke(100000);
     ChangeGameState(false);
 }
コード例 #12
0
        private void trialBtn_Click(object sender, RoutedEventArgs e)
        {
            if (_sessCreatedFlag == false)
            {
                return;
            }

            AddScore?.Invoke(sender, _testModeFlag);

            if (_testModeFlag)
            {
                if (_scorerDetails.ScoreFileName == "")
                {
                    MessageBox.Show("No Score Sheet has found for this session!!! Please create a New Score Sheet for this Session");
                    Log.Write(LogLevel.Warning, "No Score Sheet has found for this session!!! Please create a New Score Sheet for this Session");
                    return;
                }
                if (_aFlag && _bFlag && _cFlag)
                {
                    _trailPlayed = true;
                }
                else
                {
                    _trailPlayed = false;
                }
                if (_trailPlayed == false || _scoringSliderFlag == false)
                {
                    PauseAudio();
                    PlayEnabled(true);
                    MessageBox.Show("Can't iterate to next trial unless the current sample is played and scored.", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                else
                {
                    _aFlag             = false;
                    _bFlag             = false;
                    _cFlag             = false;
                    _scoringSliderFlag = false;
                }
            }
            //AddScore?.Invoke(sender, _testModeFlag);
            ResetForNextTrial();

            if (_testModeFlag)
            {
                LogScores();
            }

            DisposeAudioComponents();

            var hasMoreTrials = ConstructABCTestComponents();


            if (hasMoreTrials == false)
            {
                _allTrialsCompleted = true;


                if (_testModeFlag)
                {
                    MessageBox.Show("The Test is Complete");
                    _scoreLogger.CloseFile();
                    ResetAllInAuditionMode();
                    Log.Write(LogLevel.Info, "The Test is Complete");
                    _allTrialsCompleted = false;
                }
                else
                {
                    _sessionIndex = 0;
                    ConstructABCTestComponents();
                }
                _waveDisplay.ChannelPosition = 0.0;
            }
            else
            {
                _allTrialsCompleted = false;
            }
        }