示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("Trigger Enter");

        if (!other.gameObject.name.StartsWith("Player"))
        {
            return;
        }

        if (pj.GetIsGrounded())
        {
            other.GetComponent <PlayerStatus>().CalculateDamage(damage);
            other.GetComponent <PlayerStatus>().PlusMoney(pay, myPs.money);
            myPs.MinusMoney(pay);
        }
        else
        {
            other.GetComponent <PlayerStatus>().CalculateDamage(jumpDamage);
            other.GetComponent <PlayerStatus>().PlusMoney(jumpPay, myPs.money);
            myPs.MinusMoney(jumpPay);
        }
        audioSource.PlayOneShot(hitSE);
        audioSource.PlayOneShot(resisterSE);
        bc.enabled = false;
        Vector3 pos = this.gameObject.transform.localPosition;

        pos.x /= -2;
        pos.y /= 11;
        pos.z /= 7;
        this.gameObject.transform.localPosition = pos;
        gameObject.transform.localScale         = new Vector3(
            gameObject.transform.localScale.x / 10,
            gameObject.transform.localScale.y / 10,
            gameObject.transform.localScale.z / 10
            );
    }