Example #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);
    }
    public void GetObjectAt(out GO g, RelPos p)
    {
        int idx = p.toIdx();

        if (idx >= 0)
        {
            g = objs[idx].getObject();
        }
        else
        {
            g = null;
        }
    }
Example #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;
    }
    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;
        }
    }
 public void set(RelPos rp, GO obj)
 {
     this.rp  = rp;
     this.obj = obj;
 }
 public void empty()
 {
     this.rp  = (RelPos)0;
     this.obj = null;
 }
 public NearbyObject(RelPos rp, GO obj)
 {
     this.rp  = rp;
     this.obj = obj;
 }
Example #8
0
    private void drawDetector(RelPos p)
    {
        Vec3 pos = this.getRelPos(p);

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