using System; using org.niclasundharald.engine.graphics.primitives; using org.niclasundharald.engine.graphics; using OpenTK; namespace org.niclasundharald.engine { public class BallisticActor : Actor { public BallisticActor(int id) :base(id) { this.Model3D = ModelManager.instance.findModel("ballistisch"); for (int n=0;n < this.Model3D.vertexes.Length;n++){ this.Model3D.colors[n] = new Vector4(1.0f,0.2f + (0.5f * this.Model3D.vertexes[n].Z / -4.0f),0,1.0f); } this.Model3D.rebind(); } public override void update(float timespan) { base.update(timespan); Velocity += (Physics.Gravitation * timespan); Position += Velocity * timespan; Scale = Matrix4.CreateScale(3.0f); setHeading( Velocity, Physics.Gravitation); Console.WriteLine("BallisticActor update: {0} / {1}",Position,Velocity); try{ Vector3 ground = SquaredMap.activeMap.ground(Position.Xy); if (Position.Z <= ground.Z){ destroy(); } } catch (OutOfWorldException e){ destroy(); } } } }