コード例 #1
0
    public void AsteroidKilled(GameObject deadAsteroid)
    {
        CreatePopupText("" + asteroidPoints, deadAsteroid.transform, scoreFontSize);
        GameObject energyExplosion = Instantiate(energyExplosionPrefab);

        energyExplosion.transform.position = deadAsteroid.transform.position;
        ParticleSystem parts    = energyExplosion.GetComponent <ParticleSystem>();
        float          duration = parts.main.duration;

        Destroy(deadAsteroid);
        Destroy(energyExplosion, duration);

        //Add points
        scoreController.AddPoints(asteroidPoints);
    }
コード例 #2
0
    public void CompareGreetings()
    {
        if (CurrentGameState == GameState.CompareGreetings)
        {
            InputController.WatchSceneGesture();

            if (Player.PlayerGreeting == CurrentGuest.WantedGreeting)
            {
                CurrentGuest.SetGreetedRight(true);
                ScoreController.AddCombo(CurrentGuest.combo);
                ScoreController.AddPoints(CurrentGuest.points * ScoreController.GetCombo());
            }
            else
            {
                CurrentGuest.SetGreetedRight(false);
                ScoreController.ResetCombo();
            }

            Timer.EndTimer();

            CurrentGuest.SetGreetingTime(Timer.Time);

            CurrentGameState = GameState.WatchScene;
        }
    }
コード例 #3
0
    void OnMouseDown()
    {
        if (readyEvent.HasStarted() && timerController.isRunning())
        {
            if (click != null)
            {
                click.Play();
            }

            StartClickAnimation();

            if (clicked)
            {
                scoreController.RemovePoins(5);
            }
            else
            {
                clicked = true;

                if (this.GetComponent <SpriteRenderer> ().sprite == target)
                {
                    scoreController.AddPoints(20);
                }
                else
                {
                    scoreController.RemovePoins(10);
                }
            }
        }
    }
コード例 #4
0
    void OnCollisionEnter(Collision collision)
    {
        if (alreadyCalled)
        {
            return;
        }
        alreadyCalled = true;

        collision.rigidbody.AddForce(this.transform.forward * Force, ForceMode.Impulse);
        audioSource.PlayOneShot(audioSettings.SlingshotSound);

        scoreController.AddPoints(this.Points);
        Debug.Log("slingshot touched");
    }
コード例 #5
0
    void OnCollisionEnter(Collision collision)
    {
        if (alreadyCalled)
        {
            return;
        }
        alreadyCalled = true;

        collision.rigidbody.AddForce(-collision.contacts[0].normal * Force, ForceMode.Impulse);
        audioSource.PlayOneShot(audioSettings.BumperSound);

        scoreController.AddPoints(this.Points);
        Debug.Log("BUMP!");
    }
コード例 #6
0
    void OnCollisionEnter(Collision collision)
    {
        if (alreadyCalled)
        {
            return;
        }
        alreadyCalled = true;

        collision.rigidbody.AddForce(this.transform.forward * Force, ForceMode.Impulse);
        audioSource.PlayOneShot(audioSettings.StandUpSound);

        scoreController.AddPoints(this.Points);
        Debug.Log("Standup touched");
        StopAllCoroutines();
        StartCoroutine(ChangeLights());
    }