Esempio n. 1
0
 public override void Update(GameSettings settings)
 {
     base.Update(settings);
     time--;
     SetVelocityAdd(0f, -0.007f);
     _smoke.SetPos(GetPosition());
     _smoke.SetRot(GetRotation());
     _smoke.Blow(0.01f, 1, false);
     if (time - 1 < 0)
     {
         SoundPool.PlaySound("explode");
         SetTexture("light");
         SetSize(1.0f, 1.0f);
     }
     if (time < 0)
     {
         if (Explode)
         {
             _explosion.SetColor(_color);
             _explosion.SetPos(GetPosition());
             _explosion.Blow(0.1f, 40, false);
         }
         TomatoMainEngine.RemoveRenderObject(EntityId);
     }
 }
Esempio n. 2
0
        public override void Update(GameSettings settings)
        {
            PointFloat vel  = GetVelocity();
            float      rotV = GetRotationVelocity();

            rotV = rotV - (rotV / 50);
            if (ControlKeys.IsKeyDown("s"))
            {
                vel = MoveBackward(vel);
            }
            if (ControlKeys.IsKeyDown("w"))
            {
                vel = MoveForward(vel);
                //Console.WriteLine(GetPosition().x + " " + GetPosition().y);
            }

            if (ControlKeys.IsKeyDown("d"))
            {
                rotV = rotV + (0.05f - rotV);
            }
            if (ControlKeys.IsKeyDown("a"))
            {
                rotV = rotV + (-0.05f - rotV);
            }
            if (ControlKeys.IsKeyDown("e"))
            {
                gun.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 2.0f, GetRotation() + (float)Math.PI * 0.5f));
                gun.SetRot(GetRotation());
                gun.SetSpread(Helpers.PhysicsAndPositions.PI * 2);
                gun.SetLifeTime(100, 200);
                gun.Blow(1f, 100, false);
            }
            SetVelocity(vel);
            SetRotationVelocity(rotV);
            base.Update(settings);
            engineFirePar.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 1.0f, GetRotation() + (float)Math.PI * 1.5f));
            engineFirePar.SetRot(GetRotation() + 3.14f);
            CamController.SetPos(GetPosition());
        }