コード例 #1
0
ファイル: PlayerControls.cs プロジェクト: DarrenHobern/GGJ
    private void OnTriggerEnter(Collider thing)
    {
        if (thing.gameObject.CompareTag("GoodThing"))
        {
            if (thing.GetComponent <ObjectMovement>())
            {
                thing.GetComponent <ObjectMovement>().SeperateChildAudio();
            }

            gm.score += thing.gameObject.GetComponent <HitThing>().ScoreChange;
            Destroy(thing.gameObject);
            personCount++;

            /*if(0 == Input.GetAxisRaw("Fire"))
             * {
             *  ammoCount += 1;
             * }*/
            gm.AddPerson();

            if (CollectedGood)
            {
                CollectedGood.transform.position = this.transform.position + new Vector3(0.0f, 0.0f, -0.5f);
                CollectedGood.SetActive(true);
            }
        }
        else if (thing.gameObject.CompareTag("BadThing"))
        {
            if (thing.GetComponent <ObjectMovement>())
            {
                thing.GetComponent <ObjectMovement>().SeperateChildAudio();
            }
            gm.score += thing.gameObject.GetComponent <HitThing>().ScoreChange;
            Destroy(thing.gameObject);
            lives--;
            if (LivesTxt)
            {
                LivesTxt.text = "Property value points: " + lives;
            }
            if (lives <= 0)
            {
                gm.EndGame(false);
            }

            if (CollectedBad)
            {
                CollectedBad.transform.position = this.transform.position + new Vector3(0.0f, 0.0f, -0.5f);
                CollectedBad.SetActive(true);
            }
        }
        if (ScoreTxt)
        {
            ScoreTxt.text = "Rent: $" + gm.score;
        }
    }