Esempio n. 1
0
    public void ManualCheckTrigger(sdGameActor actor, Vector3 pos, Vector3 v)
    {
        if (!live)
        {
            return;
        }

        float      fDistance = v.magnitude;
        Vector3    vDir      = v.normalized;
        Ray        r1        = new Ray(pos + new Vector3(0, 0.1f, 0), vDir);
        Ray        r2        = new Ray(pos + new Vector3(0, actor.getHeight() - 0.1f, 0), vDir);
        RaycastHit hit;

        if (GetComponent <Collider>().Raycast(r1, out hit, fDistance))
        {
            if (CheckCondition(actor))
            {
                WhenEnterTrigger(actor.gameObject, new int[4] {
                    0, 0, 0, 0
                });
                return;
            }
        }
        if (GetComponent <Collider>().Raycast(r2, out hit, fDistance))
        {
            if (CheckCondition(actor))
            {
                WhenEnterTrigger(actor.gameObject, new int[4] {
                    0, 0, 0, 0
                });
                return;
            }
        }
    }