コード例 #1
0
    void CollideWithPlayer()
    {
        bool isGate;

        if (transform.position.y > 1.5f)
        {
            isGate = true;
        }
        else
        {
            isGate = false;
        }

        if (!isGate || !squat.isSquatting)
        {
            if ((Mathf.Abs(transform.position.z - movement.moveForward) < (bounds.size.z / 2 + 0.5f)) &&
                (jump.playerHeight <= (transform.position.y + (bounds.size.y / 2 + 1.0f))) &&
                (jump.playerHeight >= (transform.position.y - (bounds.size.y / 2 + 1.0f))) &&
                (Mathf.Abs(transform.position.x - movement.transform.position.x) < (bounds.size.x / 2f + 0.5f)))
            {
                hud.points -= 25.0000f;
                if (!squat.isSquatting)
                {
                    flash.VisualHit();
                    Destroy(this);
                }
                else
                {
                    squat.isSquatting = false;
                    flash.VisualHit();
                    Destroy(this);
                }
            }
        }
    }
コード例 #2
0
    void CollideWithPlayer()
    {
        bool isGate;

        if (transform.position.y > 1.5f)
        {
            isGate = true;
        }
        else
        {
            isGate = false;
        }

        if (!isGate || !squat.isSquatting)
        {
            if ((Mathf.Abs(transform.position.z - movement.moveForward) < (bounds.size.z / 2 + 0.5f)) &&
                (jump.playerHeight < (transform.position.y + (bounds.size.y / 2 + 1.0f))) &&
                (jump.playerHeight >= (transform.position.y - (bounds.size.y / 2 + 1.0f))) &&
                (Mathf.Abs(transform.position.x - movement.transform.position.x) < (bounds.size.x / 2 + 0.5f)))
            {
                flash.VisualHit();
                if (!squat.isSquatting && !movement.isPaused)
                {
                    StartCoroutine(Flash());
                }
            }
        }
    }
コード例 #3
0
    void Dopunch()
    {
        foreach (GameObject block in blocks)
        {
            HitBlocks hit = block.GetComponent <HitBlocks>();

            if ((Mathf.Abs(block.transform.position.z - movement.moveForward) <= 5.0f) && !hit.wallPunch)
            {
                if (((movement.leftHand.z < (movement.leftShoulder.z - 0.2f)) && (leftHandDif < -0.05f)) ||
                    ((movement.rightHand.z < (movement.rightShoulder.z - 0.2f)) && (rightHandDif < -0.05f)))
                {
                    hit.wallPunch = true;
                }

                if ((Mathf.Abs(block.transform.position.z - movement.moveForward) <= 1.0f) && !hit.wallPunch)
                {
                    hud.points -= (10.0000f / ((float)(blocks.Length)));
                    hit.VisualHit();
                    flash.VisualHit();
                }
            }
        }
    }