void OnGUI() { GUI.skin.button.fixedWidth = 200; GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height)); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height)); // display the poweup sprite if (GUILayout.Button("Show Powerup Sprite")) { _activeSprite.isVisible = false; _activeSprite = powerup; _activeSprite.isVisible = true; } // display the goblin sprite if (GUILayout.Button("Show Goblin Sprite")) { _activeSprite.isVisible = false; _activeSprite = goblin; _activeSprite.isVisible = true; } // display spineboy sprite if (GUILayout.Button("Show Spineboy Sprite")) { _activeSprite.isVisible = false; _activeSprite = spineboy; _activeSprite.isVisible = true; } // play the default animation for the active sprite if (GUILayout.Button("Play Animation")) { if (_activeSprite == powerup) { powerup.Play("animation"); } else if (_activeSprite == goblin) { goblin.Play("walk"); } else if (_activeSprite == spineboy) { spineboy.Play("walk"); } } // pause the animation if (GUILayout.Button("Pause Animation")) { _activeSprite.Pause(); } // resume it if (GUILayout.Button("Resume Animation")) { _activeSprite.Resume(); } // stop the animation and reset the pose if (GUILayout.Button("Stop Animation")) { _activeSprite.Stop(); } // adjusts the play speed if (GUILayout.Button("Slow Motion")) { _activeSprite.SetAnimationTimeScale(0.5f); } // resets the play speed if (GUILayout.Button("Normal Speed")) { _activeSprite.SetAnimationTimeScale(1.0f); } // color the entire spine blue if (GUILayout.Button("Color Sprite Blue")) { _activeSprite.color = Color.blue; } // reset the color if (GUILayout.Button("Clear Sprite Color")) { _activeSprite.color = Color.white; } // color the powerup wings if (GUILayout.Button("Powerup - Color Wings Red")) { powerup.FindSlotByName("left wing").color = Color.red; powerup.FindSlotByName("right wing").color = Color.red; } // changes the skins on the goblin if (GUILayout.Button("Goblin - Set Skin (Goblin)")) { goblin.SetSkin("goblin"); } if (GUILayout.Button("Goblin - Set Skin (GoblinGirl)")) { goblin.SetSkin("goblingirl"); } // spineboy jumps once and stops if (GUILayout.Button("Spineboy - Jump Once")) { spineboy.Play("jump", false); } // spineboy jumps in a loop if (GUILayout.Button("Spineboy - Jump Forever")) { spineboy.Play("jump", true); } // spineboy jumps and then queues walk to start and loop when jumping is finished if (GUILayout.Button("Spineboy - Jump & Walk")) { spineboy.Play("jump", false); spineboy.Queue("walk", true); } // sets the sprite scale 2x if (GUILayout.Button("Scale sprite 2x")) { _activeSprite.scale = 2.0f; } // sets the sprite scale .5x if (GUILayout.Button("Scale sprite 0.5x")) { _activeSprite.scale = 0.5f; } // resets the sprite scale if (GUILayout.Button("Reset Scale")) { _activeSprite.scale = 1.0f; } // rotate sprite 45 if (GUILayout.Button("Rotate sprite 45deg")) { _activeSprite.rotation -= 45.0f; } // reset sprite rotation if (GUILayout.Button("Reset rotation")) { _activeSprite.rotation = 0.0f; } // flip horizontally if (GUILayout.Button("Flip X")) { _activeSprite.flipX = !_activeSprite.flipX; } // flip vertically if (GUILayout.Button("Flip Y")) { _activeSprite.flipY = !_activeSprite.flipY; } GUILayout.EndScrollView(); GUILayout.EndArea(); }
void OnGUI() { GUI.skin.button.fixedWidth = 200; GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height)); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height)); if (GUILayout.Button("Goblins Example")) { Application.LoadLevel("GoblinsExample"); } if (GUILayout.Button("Powerup Example")) { Application.LoadLevel("PowerupExample"); } if (GUILayout.Button("Spineboy Original Example")) { Application.LoadLevel("SpineboyOriginalExample"); } if (GUILayout.Button("Spineboy Spaceman Example")) { Application.LoadLevel("SpineboySpacemanExample"); } if (GUILayout.Button("Play Animation")) { sprite.Play("animation"); } if (GUILayout.Button("Pause Animation")) { sprite.Pause(); } if (GUILayout.Button("Resume Animation")) { sprite.Resume(); } if (GUILayout.Button("Stop Animation")) { sprite.Stop(); } if (GUILayout.Button("Slow Motion")) { sprite.SetAnimationTimeScale(0.5f); } if (GUILayout.Button("Normal Speed")) { sprite.SetAnimationTimeScale(1.0f); } if (GUILayout.Button("Tint Wings Red")) { sprite.FindSlotByName("left wing").color = Color.red; sprite.FindSlotByName("right wing").color = Color.red; } if (GUILayout.Button("Tint Entire Sprite Blue")) { sprite.color = Color.blue; } if (GUILayout.Button("Clear Tint")) { sprite.color = Color.white; } if (GUILayout.Button("Scale sprite 2x")) { sprite.scale = 2.0f; } if (GUILayout.Button("Scale sprite 0.5x")) { sprite.scale = 0.5f; } if (GUILayout.Button("Reset Scale")) { sprite.scale = 1.0f; } if (GUILayout.Button("Rotate sprite 45deg")) { sprite.rotation -= 45.0f; } if (GUILayout.Button("Reset rotation")) { sprite.rotation = 0.0f; } if (GUILayout.Button("Flip X")) { sprite.flipX = !sprite.flipX; } if (GUILayout.Button("Flip Y")) { sprite.flipY = !sprite.flipY; } GUILayout.EndScrollView(); GUILayout.EndArea(); }
void OnGUI() { GUI.skin.button.fixedWidth = 200; GUILayout.BeginArea(new Rect(0, 0, GUI.skin.button.fixedWidth + 25, Screen.height)); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(GUI.skin.button.fixedWidth + 25), GUILayout.Height(Screen.height)); if (GUILayout.Button("Goblins Example")) { Application.LoadLevel("GoblinsExample"); } if (GUILayout.Button("Powerup Example")) { Application.LoadLevel("PowerupExample"); } if (GUILayout.Button("Spineboy Original Example")) { Application.LoadLevel("SpineboyOriginalExample"); } if (GUILayout.Button("Spineboy Spaceman Example")) { Application.LoadLevel("SpineboySpacemanExample"); } if (GUILayout.Button("Play Animation")) { sprite.Play("walk"); } if (GUILayout.Button("Pause Animation")) { sprite.Pause(); } if (GUILayout.Button("Resume Animation")) { sprite.Resume(); } if (GUILayout.Button("Stop Animation")) { sprite.Stop(); } if (GUILayout.Button("Slow Motion")) { sprite.SetAnimationTimeScale(0.5f); } if (GUILayout.Button("Normal Speed")) { sprite.SetAnimationTimeScale(1.0f); } if (GUILayout.Button("Idle Animation")) { sprite.Play("idle", true); } if (GUILayout.Button("Walk Animation")) { sprite.Play("walk", true); } if (GUILayout.Button("Run Animation")) { sprite.Play("run", true); } if (GUILayout.Button("Jump Animation")) { sprite.Play("jump", false); sprite.Queue("idle"); } if (GUILayout.Button("Hit Animation")) { sprite.Play("hit", false); sprite.Queue("idle"); } if (GUILayout.Button("Shoot Animation")) { sprite.Play("shoot", false); sprite.Queue("idle"); } if (GUILayout.Button("Death Animation")) { sprite.Play("death", false); } if (GUILayout.Button("Tint Blue")) { sprite.color = Color.blue; } if (GUILayout.Button("Clear Tint")) { sprite.color = Color.white; } if (GUILayout.Button("Scale sprite 2x")) { sprite.scale = 2.0f; } if (GUILayout.Button("Scale sprite 0.5x")) { sprite.scale = 0.5f; } if (GUILayout.Button("Reset Scale")) { sprite.scale = 1.0f; } if (GUILayout.Button("Rotate sprite 45deg")) { sprite.rotation -= 45.0f; } if (GUILayout.Button("Reset rotation")) { sprite.rotation = 0.0f; } if (GUILayout.Button("Flip X")) { sprite.flipX = !sprite.flipX; } if (GUILayout.Button("Flip Y")) { sprite.flipY = !sprite.flipY; } GUILayout.EndScrollView(); GUILayout.EndArea(); }