1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
module br.append;
private import opengl;
private import util.key;
private import util.shape;
private import br.mainloop;
private import util.vector;
private import util.matrix;
private import std.math;
private import br.ship;
private import br.enemy;
private import br.gamemanager;
private import util.particle;
private import util.parts;
private import util.log;
public class Append:Parts{
private:
int vanishCount;
bool parentExist;
public this(Shape shape ,double size ,double R = 1.0,double G = 1.0 ,double B = 1.0,double alpha = 1.0 ,Matrix poseBase = new Matrix()){
this.shape = cast(Shape)shape.clone();
drawing = WIRE;
this.size = size;
setPoseBase(poseBase);
// appendManager.add(this);
this.R = R;
this.G = G;
this.B = B;
this.alpha = alpha;
parentExist = true;
}
public void setCollision(double collisionSize){
collisionManager.add(this, collisionManager.kind.SHIP ,2);
collisionManager.add(this, collisionManager.kind.SWORD ,2);
this.collisionRange = collisionSize;
drawing = POLYGON | WIRE;
}
public override void move(){
super.move();
if(parentExist & (parent is null || parent.exists == false)){
parentExist = false;
vanishCount = 5;
}
if(parentExist == false){
vanishCount --;
if(vanishCount < 0)destroy();
}
}
public override void destroy(){
super.destroy();
makeParticle(shape, size ,WIRE ,rpos ,new Vector3() ,rpose ,R ,G ,B ,alpha);
}
}
/+
public class BaseOfWing:Parts{
private{
static float[][] a =
[
[-0.2 ,0 ,0.2 ],
[-0.2 ,0 ,0.2 ]
];
static float[][] b =
[
[0 ,0.5 ,0 ],
[0 ,1.0 ,0 ]
];
}
public this(){
shape = BaseOfWing1.getShape();//new SH_Pole(a,b,4);
drawing = WIRE;
size = 30;
}
}
public class Wing:Parts{
private{
static float[][] a =
[
[-1.0 ,-0.5 ,1.0 ],
];
static float[][] b =
[
[0 ,0.5 ,0 ]
];
}
public this(){
/*
Shape shape1 = new SH_Pole(a,b,4);
Shape shape2 = cast(SH_Pole)shape1.clone();
shape1.translate(new Vector3(0.1 ,0 ,0));
shape2.translate(new Vector3(-0.1 ,0 ,0));
shape = shape1 + shape2;
*/
shape = Wing1.getShape();//new SH_Pole(a,b,4);
//shape.translate(new Vector3(1.0 ,0 ,0));
drawing = WIRE;
size = 20;
}
}
public class Tail:Parts{
private{
static float[][] a =
[
[-1.0 ,-0.5 ,1.0 ],
];
static float[][] b =
[
[0 ,0.5 ,0 ]
];
}
public this(){
shape = Tail1.getShape();//new SH_Pole(a,b,4);
drawing = WIRE;
size = 20;
}
}
public class Head:Parts{
private{
static float[] a =
[-1.0 ,-0.5 ,1.0 ,-0.5 ]
;
static float[] b =
[0 ,0.5 ,0 ,-0.5 ]
;
static float[] z =
[-0.5 ,0 ,0.5];
static float[] scale =
[0.3 ,1.0 ,0.3];
}
public this(){
shape = Head1.getShape();//new SH_Pot(a,b,z,scale);
drawing = WIRE;
size = 30;
}
}
+/
|