コード例 #1
0
    public void Decrease(int value)
    {
        health -= value;
        if (health <= 0)
        {
            health = 0;
            if (gss != null)
            {
                gss.Increase(PointReward);
            }
            if (css != null)
            {
                css.SaveCat();
            }

            if (gameObject.tag == "Player")
            {
                gameObject.SetActive(false);
                canvasHud.SetActive(false);
                canvasEnd.SetActive(true);
                endText.text = gameObject.GetComponent <GameScoreScript>().GetDeathMessage();
            }
            else
            {
                GameObject.Destroy(gameObject);
            }
        }
        UpdateHealthBar();
    }
コード例 #2
0
    public void Collect(string item)
    {
        switch (item)
        {
        case "PV_100": gss.Increase(100); break;

        case "PV_200": gss.Increase(200); break;

        case "PV_500": gss.Increase(500); break;

        case "PV_1000": gss.Increase(1000); break;

        case "PV_2000": gss.Increase(2000); break;

        case "PV_3000": gss.Increase(3000); break;

        case "PV_5000": gss.Increase(5000); break;

        case "PV_10000": gss.Increase(10000); break;

        case "BO_H": hps.IncreaseMax(15); break;

        case "BO_J": pc.IncreaseJumpHeight(); break;

        case "BO_D": pc.IncreaseAttackMult(); break;

        case "CAT_1": gss.SaveCat(1); gss.Increase(2500); break;

        case "CAT_2": gss.SaveCat(2); gss.Increase(2500); break;

        case "CAT_3": gss.SaveCat(3); gss.Increase(2500); break;

        case "CAT_4": gss.SaveCat(0); gss.Increase(2500); break;

        default: pis.AddItem(item); break;
        }
    }