void Start(){
		wiicontroller = GetComponent<WiiController> ();
		simplecontroller = GetComponent<SimpleController> ();
		wiidblcontroller = GetComponent<WiiDoubleCtrl> ();
		mouselookmod = gameObject.GetComponentInChildren<MouseLookMod> ();
		thrustersound = GameObject.Find("Thrusters").GetComponent<ThrusterSound>();
		totTime = timer;


		logdead = false;

		//InvokeRepeating ("logPlayer", 1f, 1f);
		//dead = false;
		log = GetComponent<Log> ();
	}
	// Use this for initialization
	void Start () {
		maxfuel = fuel;
		thrustersound = GameObject.Find("Thrusters").GetComponent<ThrusterSound>();
	}
Beispiel #3
0
        public override void Update()
        {
            base.Update();

            forwardThrust = 2;
            leftThrust    = 0.12f;
            rightThrust   = 0.12f;
            backThrust    = 1;

            for (int i = 0; i < shipParts.Count; i++)
            {
                if (shipParts[i].MyType == 2)
                {
                    if (shipParts[i].rotationOffSet == 0)
                    {
                        forwardThrust += 10;
                    }
                    if (shipParts[i].rotationOffSet == -180)
                    {
                        backThrust += 5;
                    }
                    if (shipParts[i].rotationOffSet == -90)
                    {
                        leftThrust += 2;
                    }
                    if (shipParts[i].rotationOffSet == -270)
                    {
                        rightThrust += 2;
                    }
                }
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.W))
            {
                Velocity.X += (float)Math.Cos(FP.RAD * ShipCenter.Angle) * forwardThrust * FP.Elapsed;
                Velocity.Y += (float)Math.Sin(FP.RAD * ShipCenter.Angle) * forwardThrust * FP.Elapsed;
            }
            else
            {
                ClearTweens();
            }
            if (ThrusterSound.Status != SFML.Audio.SoundStatus.Playing && (Input.Pressed(Keyboard.Key.W) || Input.Pressed(Keyboard.Key.A) || Input.Pressed(Keyboard.Key.S) || Input.Pressed(Keyboard.Key.D)))
            {
                ThrusterSound.Loop();
            }
            if (!Input.Down(Keyboard.Key.W) && !Input.Down(Keyboard.Key.A) && !Input.Down(Keyboard.Key.S) && !Input.Down(Keyboard.Key.D))
            {
                ThrusterSound.Stop();
            }
            X          += Velocity.X;
            Y          += Velocity.Y;
            Velocity.X *= 0.97f;
            Velocity.Y *= 0.97f;
            if (Keyboard.IsKeyPressed(Keyboard.Key.S))
            {
                Velocity.X -= (float)Math.Cos(FP.RAD * ShipCenter.Angle) * backThrust * FP.Elapsed;
                Velocity.Y -= (float)Math.Sin(FP.RAD * ShipCenter.Angle) * backThrust * FP.Elapsed;
            }

            if (Keyboard.IsKeyPressed(Keyboard.Key.A))
            {
                ShipCenter.Angle += rightThrust;
            }

            if (Keyboard.IsKeyPressed(Keyboard.Key.D))
            {
                ShipCenter.Angle -= leftThrust;
            }
            //SetHitboxTo(ShipCenter);
            //CenterOrigin();
            FP.Camera.X     = X;
            FP.Camera.Y     = Y;
            FP.Camera.Angle = ShipCenter.Angle - 90;
        }