コード例 #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        FlagTouched            = true;
        FlagRigidbody.velocity = new Vector2(0, -6);
        if (!executed)
        {
            AudioSource_script.FlagTouch = true; // Changes background music
            executed = true;
        }

        float marioPositionY = collision.transform.position.y;

        if (!Mario_script.InAir)                    // Sets scoore depending where Mario touched flag pole
        {
            scooreScript.SetScoore("100");
        }
        else if (marioPositionY < 7.2f)
        {
            scooreScript.SetScoore("400");
        }
        else
        {
            scooreScript.SetScoore("5000");
        }
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (flip && !Damaged) // Flip was performed because Mario hit block under enemy
        {
            SetScoore("200");
            Damaged = true;
        }

        if (GlobalFreezMovement)
        {
            EnemyRigidbody.velocity = Vector2.zero;
        }

        if (!freezeMovement && !GlobalFreezMovement)
        {
            Movement();
        }

        if (flip)
        {
            Flip(transform);
        }

        NormalizeScooreLocalScale();

        if (shellSlide && !executedScoore)
        {
            if (Mario_script.InAir)
            {
                scooreScript2.SetScoore("500");
            }
            else
            {
                scooreScript2.SetScoore("400");
            }

            executedScoore = true;
        }

        Animations();

        BackToLife();
    }
コード例 #3
0
ファイル: CoinScript.cs プロジェクト: ReisEdgar/mobileGame
    // Update is called once per frame
    void Update()
    {
        if ((transform.position.y > QuestionBlockCenter + 3)) // If a coin moved vertically by more than 3 units
        {                                                     // it is being pushed down
            CoinRigibody.AddRelativeForce(new Vector2(0, -9), ForceMode2D.Impulse);
            goingDown = true;
        }

        if (transform.position.y < QuestionBlockCenter + 1.4f && goingDown) // If a coin, while moving down, is less than 1.4 units away from Question block center it disapears.
        {
            scoore.position = new Vector2(scoore.position.x, QuestionBlockCenter);
            script.SetScoore("200");
            GameControl.AddCoin();
            Destroy(gameObject);
        }
    }
コード例 #4
0
 protected void SetScoore(string scoore)
 {
     scooreScript.SetScoore(scoore);
 }