Ejemplo n.º 1
0
    public void OnExitRelativeCollision(RelCol rc, UnityEngine.Collider c)
    {
        GO other = c.gameObject;

        if (!isBlock(other))
        {
            return;
        }
        Tr trOther = other.transform;

        List node = null;

        if (this.touchingList.block == trOther)
        {
            node = this.touchingList;
            this.touchingList = this.touchingList.next;
        }
        else
        {
            List prev = this.touchingList;
            while (prev.next.block != trOther)
            {
                prev = prev.next;
            }

            node      = prev.next;
            prev.next = prev.next.next;
        }
        node.next      = this.emptyList;
        this.emptyList = node;
    }
Ejemplo n.º 2
0
    private void createDetector(RelPos p)
    {
        UnityEngine.Transform t = this.transform;
        Vec3 newPos;
        GO   clone;

        newPos = this.getRelPos(p);

        /* XXX: This was the only way I found to instantiate the clone
         * in local space... */
        clone      = Obj.Instantiate(this.dummy, t.position, Quat.identity, t);
        clone.name = p.ToString();
        clone.transform.Translate(newPos, UnityEngine.Space.World);
        RelCol rc = clone.GetComponent <RelCol>();

        rc.pos = p;
    }
Ejemplo n.º 3
0
    public void OnEnterRelativeCollision(RelCol rc, UnityEngine.Collider c)
    {
        int idx = rc.pos.toIdx();

        if (idx >= 0)
        {
            this.objs[idx].set(rc.pos, c.gameObject);
            if (this.cbs[idx] != null)
            {
                this.cbs[idx](true, rc.pos, c.gameObject);
            }
            else if (this.undefCbs != null)
            {
                this.undefCbs(true, rc.pos, c.gameObject);
            }
        }
        else if (this.undefCbs != null)
        {
            this.undefCbs(true, rc.pos, c.gameObject);
        }
    }
Ejemplo n.º 4
0
    public void OnEnterRelativeCollision(RelCol rc, UnityEngine.Collider c)
    {
        GO other = c.gameObject;

        if (!isBlock(other) || this.emptyList == null)
        {
            return;
        }

        List node = this.emptyList;

        this.emptyList = this.emptyList.next;
        int y = (int)other.transform.position.y;

        if (this.touchingList == null || y > this.touchingList.y)
        {
            node.next         = this.touchingList;
            this.touchingList = node;
        }
        else if (this.touchingList.next == null)
        {
            this.touchingList.next = node;
            node.next = null;
        }
        else
        {
            List prev = this.touchingList;
            while (prev.next != null && y <= prev.next.y)
            {
                prev = prev.next;
            }
            node.next = prev.next;
            prev.next = node;
        }

        node.y     = y;
        node.block = other.transform;
    }
Ejemplo n.º 5
0
    public void OnExitRelativeCollision(RelCol rc, UnityEngine.Collider c)
    {
        int idx = rc.pos.toIdx();

        if (idx >= 0)
        {
            if (this.objs[idx].isEqual(c.gameObject))
            {
                this.objs[idx].empty();
            }
            if (this.cbs[idx] != null)
            {
                this.cbs[idx](false, rc.pos, c.gameObject);
            }
            else if (this.undefCbs != null)
            {
                this.undefCbs(false, rc.pos, c.gameObject);
            }
        }
        else if (this.undefCbs != null)
        {
            this.undefCbs(false, rc.pos, c.gameObject);
        }
    }