Beispiel #1
0
	void FixedUpdate()
	{
		GameManager.GameState gameState = MyGameManager.GetComponent<GameManager>().CurrentGameState;
		if (gameState != GameManager.GameState.AIMING && gameState != GameManager.GameState.THROWING)
		{
			Velocity.Scale(new Vector3(0.98f, 0.98f));
			transform.position += Velocity / 60;
		}
	}
Beispiel #2
0
	// Update is called once per frame
	protected override void LateUpdate()
	{
		GameManager.GameState gameState = MyGameManager.GetComponent<GameManager>().CurrentGameState;
		// I hate C#
		// I know I'm doing this wrong
		// But I still hate C#
		if (gameState == GameManager.GameState.AIMING || gameState == GameManager.GameState.THROWING)
		{
			rockOffset = new Vector3(-0.7f, -0.05f);
			base.LateUpdate();
		}
	}
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (paused)
     {
         return;
     }
     GameManager.GameState gameState = MyGameManager.GetComponent <GameManager>().CurrentGameState;
     if (gameState == GameManager.GameState.SWEEPING)
     {
         float   maxSweepOffset = 0.4f;
         Vector3 offsetDelta    = new Vector3(0f, 0.03f);
         if (Utils.GetKey_Up() && SweepOffset.y < maxSweepOffset)
         {
             SweepOffset += offsetDelta;
         }
         if (Utils.GetKey_Down() && SweepOffset.y > -maxSweepOffset)
         {
             SweepOffset -= offsetDelta;
         }
         if (Utils.GetKey_Confirm() || broomAnimate > 0)
         {
             if (broomAnimate == 0f)
             {
                 if (Utils.GetKeyDown_Confirm())
                 {
                     singleSweepSource.Play();
                 }
                 else
                 {
                     multiSweepSource.Play();
                 }
             }
             broomAnimate += 0.6f;
         }
         if (broomAnimate >= 2 * Mathf.PI)
         {
             broomAnimate = 0;
         }
         Broom.transform.localPosition = baseBroomOffset + new Vector3(0f, Mathf.Sin(broomAnimate) * 0.15f);
     }
     else if (gameState == GameManager.GameState.WATCHING)
     {
         if (Broom.GetComponent <SpriteRenderer>().color.a > 0)
         {
             Broom.GetComponent <SpriteRenderer>().color -= new Color(0, 0, 0, 0.05f);
         }
         else if (GetComponent <SpriteRenderer>().color.a > 0)
         {
             GetComponent <SpriteRenderer>().color -= new Color(0, 0, 0, 0.05f);
         }
     }
 }