private void addTelepoter(int x, int y, float dir, int xDist, int yDist) { GameObject teleporter = Instantiate(entityBank[0], new Vector3(x, y, 0), Quaternion.identity); teleporter teleScript = teleporter.GetComponent(typeof(teleporter)) as teleporter; teleScript.setDirection(dir); teleScript.setDist(xDist, yDist); getScript(teleporter).createEntity(this, x, y); }
public void setTeleporter(teleporter tele, int type) //assign and link teleporters of same type { //type is if it's X,Y,Z, with 0=x,1=y,2=z if (type == 0) //X { if (teleX [0] != null) { teleX [1] = tele; //link em } else { teleX [0] = tele; } } else if (type == 1) //y { if (teleY [0] != null) { teleY [1] = tele; //link em } else { teleY [0] = tele; } } else if (type == 2) //z { if (teleZ [0] != null) { teleZ [1] = tele; //link em } else { teleZ [0] = tele; } } }