Exemplo n.º 1
0
    private Vec3 getRelPos(RelPos p)
    {
        Vec3 pos = new Vec3();

        for (RelPos tmp = p; tmp != 0; tmp = tmp.shift())
        {
            pos += tmp.masked().toPosition();
        }
        return(pos);
    }
Exemplo n.º 2
0
    public void GetObjectAt(out GO g, RelPos p)
    {
        int idx = p.toIdx();

        if (idx >= 0)
        {
            g = objs[idx].getObject();
        }
        else
        {
            g = null;
        }
    }
Exemplo n.º 3
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;
    }
Exemplo n.º 4
0
    public void SetRelativePositionCallback(
        System.Tuple <RelPos, System.Action <bool, RelPos, GO> > arg)
    {
        RelPos p = arg.Item1;

        System.Action <bool, RelPos, GO> cb = arg.Item2;

        if (this.cbs == null)
        {
            int count = ((RelPos)0).count();
            this.cbs = new System.Action <bool, RelPos, GO> [count];
        }

        int idx = p.toIdx();

        if (idx >= 0)
        {
            this.cbs[idx] = cb;
        }
        else
        {
            this.undefCbs = cb;
        }
    }
Exemplo n.º 5
0
 public void set(RelPos rp, GO obj)
 {
     this.rp  = rp;
     this.obj = obj;
 }
Exemplo n.º 6
0
 public void empty()
 {
     this.rp  = (RelPos)0;
     this.obj = null;
 }
Exemplo n.º 7
0
 public NearbyObject(RelPos rp, GO obj)
 {
     this.rp  = rp;
     this.obj = obj;
 }
Exemplo n.º 8
0
    private void drawDetector(RelPos p)
    {
        Vec3 pos = this.getRelPos(p);

        UnityEngine.Gizmos.DrawWireSphere(this.transform.position + pos, this.gizmoRadius);
    }