public override void update(WorldInterface world) { life++; if (move(world, moveTarget * moveSpeed)) { world.removeEntity(entityId); } }
public override void update(WorldInterface world) { if (rand.Next() % 30 == 0) { double r = rand.NextDouble() * MathCustom.r360; moveTarget = new Vector2((float)Math.Sin(r), (float)Math.Cos(r)); } move(world, moveTarget * moveSpeed); }
public void read(NetworkStream stream, WorldInterface world) { world.updateEntity(stream, entityId); }
public override void update(WorldInterface world) { }
public override void clientUpdate(Game game, WorldInterface world) { if (speed != Vector2.Zero) { move(world, speed); } }
public override void clientUpdate(Game game, WorldInterface world) { Vector2 dif = new Vector2(); if (game.inputControl.keyMoveForward.down) { dif.X += (float)Math.Sin(-game.camera.rotation.Y + MathCustom.r180); dif.Y += (float)Math.Cos(-game.camera.rotation.Y + MathCustom.r180); } if (game.inputControl.keyMoveBackward.down) { dif.X += (float)Math.Sin(-game.camera.rotation.Y); dif.Y += (float)Math.Cos(-game.camera.rotation.Y); } if (game.inputControl.keyMoveLeft.down) { dif.X += (float)Math.Sin(-game.camera.rotation.Y + MathCustom.r270); dif.Y += (float)Math.Cos(-game.camera.rotation.Y + MathCustom.r270); } if (game.inputControl.keyMoveRight.down) { dif.X += (float)Math.Sin(-game.camera.rotation.Y + MathCustom.r90); dif.Y += (float)Math.Cos(-game.camera.rotation.Y + MathCustom.r90); } if (dif != Vector2.Zero) { dif.Normalize(); if (game.isMP) { game.sendPacket(new PacketPlayerInput(position.Xz, speed, entityId, world.worldId)); } speed += dif * accSpeed; } speed.X *= .8f; speed.Y *= .8f; speed.X = MathCustom.bound(speed.X, -moveSpeed, moveSpeed); speed.Y = MathCustom.bound(speed.Y, -moveSpeed, moveSpeed); if (speed != Vector2.Zero) { move(world, speed); } if (game.inputControl.keyAttack.pressed) { //game.sendNewEntity(new EntityShot(position, this, MathCustom.r180-game.camera.rotation.Y, 0), world.worldId); game.world.addNewEntity(new EntityShot(position, this, MathCustom.r180-game.camera.rotation.Y, 0)); //swingAngle = -MathCustom.r45; //swingVisable = true; } if (swingVisable) { swingAngle += MathCustom.r5; if (swingAngle > MathCustom.r45) { swingVisable = false; } } if (Keyboard.GetState().IsKeyDown(Key.T)) { game.world.addNewEntity(new EntityMonster(position, 0)); } game.camera.position = -position; }