package t3d; public class Particle{ public Vector3D place; public Vector3D move; public int age = 1; int maxAge = 60; public Particle(){ place = new Vector3D(0,0,0); place = new Vector3D(0,0,0); age = -1; } public Particle(double px,double py,double pz,double mx,double my,double mz){ this(new Vector3D(px,py,pz),new Vector3D(mx,my,mz)); } public Particle(double px,double py,double pz,double mx,double my,double mz,int maxAge){ this(new Vector3D(px,py,pz),new Vector3D(mx,my,mz), maxAge); } public Particle(Vector3D place,Vector3D move){ this.place = place; this.move = move; age = 1; } public Particle(Vector3D place,Vector3D move,int maxAge){ this.place = place; this.move = move; this.maxAge = maxAge; age = 1; } public boolean isAlive(){ return age > 0; } public void setValue(double px,double py,double pz,double mx,double my,double mz){ place.setValue(px,py,pz); move.setValue(mx,my,mz); age = 1; } public void setValue(double px,double py,double pz,double mx,double my,double mz,int maxAge){ place.setValue(px,py,pz); move.setValue(mx,my,mz); age = 1; this.maxAge = maxAge; } public void move(){ this.place.add(move); if (age >= maxAge){ age = -1; }else{ age++; } } public void kill(){ age = -1; } }