Mercurial > hg > Members > tatsuki > Alice
changeset 143:0651fb36a369 working
demo for Open Source Conference
author | sugi |
---|---|
date | Thu, 20 Sep 2012 22:44:11 +0900 |
parents | 287aae21e7d8 |
children | e58794b067f5 |
files | src/alice/test/topology/aquarium/AutoIncrement.java src/alice/test/topology/aquarium/CheckMyName.java src/alice/test/topology/aquarium/FishPoint.java src/alice/test/topology/aquarium/KeyInputCodeSegment.java src/alice/test/topology/aquarium/SetLocation.java |
diffstat | 5 files changed, 15 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/test/topology/aquarium/AutoIncrement.java Thu Sep 20 22:05:32 2012 +0900 +++ b/src/alice/test/topology/aquarium/AutoIncrement.java Thu Sep 20 22:44:11 2012 +0900 @@ -23,12 +23,12 @@ max = this.number.asInteger()*2-1+0.3f; FishPoint fp = this.position.asClass(FishPoint.class); if (fp.getX()+0.01>max){ - fp.setXY(min, fp.getY()); + fp.setXYZ(min, fp.getY(), fp.getZ()); } else if (fp.getX()+0.01< min){ - fp.setXY(max, fp.getY()); + fp.setXYZ(max, fp.getY(), fp.getZ()); } else { - fp.setXY(fp.getX()+0.01f, fp.getY()); + fp.setXYZ(fp.getX()+0.01f, fp.getY(), fp.getZ()); } ods.update("local", key, fp); @@ -38,7 +38,7 @@ // Waiting should be done in Alice kernel // ids.create(CommandType.WAIT); - wait(10); + wait(20); } catch (InterruptedException e) { e.printStackTrace(); }
--- a/src/alice/test/topology/aquarium/CheckMyName.java Thu Sep 20 22:05:32 2012 +0900 +++ b/src/alice/test/topology/aquarium/CheckMyName.java Thu Sep 20 22:44:11 2012 +0900 @@ -60,7 +60,15 @@ for (int i = 0;i < 3 ; i++){ key = "fish"+i; if (num == 0) new AutoIncrement(key,0); - ods.update("local", key, new FishPoint(0.2f*i,0.2f*i)); + ods.update("local", key, new FishPoint(0.2f*i, 0.2f*i, 0.2f*i)); + new SetLocation(new MakeObject(frame), key, 0, num); + new CheckLocalIndex(key,1); + } + + for (int i = 3;i < 6 ; i++){ + key = "fish"+i; + if (num == 0) new AutoIncrement(key,0); + ods.update("local", key, new FishPoint(-0.2f*i, -0.2f*i, -0.2f*i)); new SetLocation(new MakeObject(frame), key, 0, num); new CheckLocalIndex(key,1); }
--- a/src/alice/test/topology/aquarium/FishPoint.java Thu Sep 20 22:05:32 2012 +0900 +++ b/src/alice/test/topology/aquarium/FishPoint.java Thu Sep 20 22:44:11 2012 +0900 @@ -8,7 +8,6 @@ public float x = 0.0f; public float y = 0.0f; public float z = 0.0f; - public String vector = "light"; public FishPoint(){} @@ -46,8 +45,4 @@ return this.z; } - public String getVector(){ - return this.vector; - } - }
--- a/src/alice/test/topology/aquarium/KeyInputCodeSegment.java Thu Sep 20 22:05:32 2012 +0900 +++ b/src/alice/test/topology/aquarium/KeyInputCodeSegment.java Thu Sep 20 22:44:11 2012 +0900 @@ -12,7 +12,7 @@ @Override public void keyPressed(KeyEvent event) { - System.out.println(event.getKeyCode()); + //System.out.println(event.getKeyCode()); switch(event.getKeyCode()) { case 37: // left
--- a/src/alice/test/topology/aquarium/SetLocation.java Thu Sep 20 22:05:32 2012 +0900 +++ b/src/alice/test/topology/aquarium/SetLocation.java Thu Sep 20 22:44:11 2012 +0900 @@ -21,15 +21,8 @@ @Override public void run(){ - FishPoint fp = this.position.asClass(FishPoint.class); - //obj.setLocation(fp.getX() - 2*range, fp.getY()); - - float startX = 2*range - 1.5f; - float endX = 2*range + 1.5f; - if (startX <= fp.getX() && fp.getX() < endX) - obj.setLocation(fp.getX() - 2*range, fp.getY()); - + obj.setLocation(fp.getX() - 2*range, fp.getY(), fp.getZ()); new SetLocation(this.obj, this.key, this.position.index, this.range); }