void SaveSettingsGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Save Settings", titles); activateSave = EditorGUILayout.Toggle("Show Save Settings", activateSave); switch (activateSave) { case false: break; case true: fileName = EditorGUILayout.TextField("Save File Name As: ", fileName); save = EditorGUILayout.Toggle("Save File?", save); switch (save) { case false: break; case true: playerController.SaveSettings(fileName); save = false; activateSave = false; Debug.Log("Saved " + fileName); break; } break; } }
void LoadSettingsGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Load Settings", titles); activateLoad = EditorGUILayout.Toggle("Show Load Settings", activateLoad); switch (activateLoad) { case false: break; case true: fileName = EditorGUILayout.TextField("Load File With Name: ", fileName); load = EditorGUILayout.Toggle("Load File?", load); switch (load) { case false: break; case true: playerController.LoadSettings(fileName); load = false; activateLoad = false; Debug.Log("Loaded Settings From " + fileName); break; } break; } }
void PlayerJumpGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Player Jump", titles); //public JumpType jumpType = JumpType.PreItalianPlumber; playerController.playerControllerData.initialBurstJump = EditorGUILayout.FloatField("Initial Jump Velocity", playerController.playerControllerData.initialBurstJump); playerController.playerControllerData.jumpVelocityDegradation = EditorGUILayout.FloatField("Jump Velocity Degradation", playerController.playerControllerData.jumpVelocityDegradation); playerController.playerControllerData.jumpVelocityDegradationWall = EditorGUILayout.FloatField(new GUIContent("Wall Friction", "Friction Multiplier when against terrain"), playerController.playerControllerData.jumpVelocityDegradationWall); playerController.playerControllerData.useCoyoteTime = EditorGUILayout.Toggle("Use Coyote Time", playerController.playerControllerData.useCoyoteTime); switch (playerController.playerControllerData.useCoyoteTime) { case false: break; case true: playerController.playerControllerData.coyoteTime = EditorGUILayout.FloatField("Coyote Time", playerController.playerControllerData.coyoteTime); break; } playerController.playerControllerData.usePreEmptiveCoyoteTime = EditorGUILayout.Toggle("Use Pre-Emptive Coyote Time", playerController.playerControllerData.usePreEmptiveCoyoteTime); switch (playerController.playerControllerData.usePreEmptiveCoyoteTime) { case false: break; case true: playerController.playerControllerData.preEmptiveCoyoteTime = EditorGUILayout.FloatField("Pre-Emptive Coyote Time", playerController.playerControllerData.preEmptiveCoyoteTime); break; } PlayerWallJumpGUI(playerController); }
void SlopeMovementSettingsGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Slope Settings", titles); playerController.playerControllerData.useSlopeMovement = EditorGUILayout.Toggle("Use Slope Movement", playerController.playerControllerData.useSlopeMovement); switch (playerController.playerControllerData.useSlopeMovement) { case false: break; case true: playerController.playerControllerData.maximumSlopeAngle = EditorGUILayout.FloatField("Maximum Travesable Angle", playerController.playerControllerData.maximumSlopeAngle); playerController.playerControllerData.useSlopeSlideMovement = EditorGUILayout.Toggle("Use Slope Slide", playerController.playerControllerData.useSlopeSlideMovement); switch (playerController.playerControllerData.useSlopeSlideMovement) { case false: break; case true: playerController.playerControllerData.maximumSlopeSlide = EditorGUILayout.FloatField("Slide At Angle", playerController.playerControllerData.maximumSlopeSlide); break; } break; } }
void AccelerationGUIDisplay(TwoDTools.PlayerController2D playerController) { playerController.playerControllerData.useAcceleration = EditorGUILayout.Toggle("Use Acceleration", playerController.playerControllerData.useAcceleration); switch (playerController.playerControllerData.useAcceleration) { case true: playerController.playerControllerData.acceleration = EditorGUILayout.FloatField("Acceleration", playerController.playerControllerData.acceleration); playerController.playerControllerData.deceleration = EditorGUILayout.FloatField("Deceleration", playerController.playerControllerData.deceleration); playerController.playerControllerData.useSprint = EditorGUILayout.Toggle("Use Sprint", playerController.playerControllerData.useSprint); switch (playerController.playerControllerData.useSprint) { case true: playerController.playerControllerData.sprintSpeedMultiplier = EditorGUILayout.FloatField("Sprint Speed Multiplier", playerController.playerControllerData.sprintSpeedMultiplier); break; } //end sprint playerController.playerControllerData.useAirMomentum = EditorGUILayout.Toggle("Use Air Momentum", playerController.playerControllerData.useAirMomentum); switch (playerController.playerControllerData.useAirMomentum) { case true: playerController.playerControllerData.airAcceleration = EditorGUILayout.FloatField("Air Acceleration", playerController.playerControllerData.airAcceleration); playerController.playerControllerData.airDeceleration = EditorGUILayout.FloatField("Air Deceleration", playerController.playerControllerData.airDeceleration); break; } // end airMomentum break; }//end acceleration }
void RaycastGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Horizontal Raycast Setup", miniTitles); RaycastHorizontalGUISetup(playerController); GUILayout.Label("Vertical Raycast Setup", miniTitles); RaycastVerticalGUISetup(playerController); playerController.playerControllerData.terrainLayer = TwoDTools.TwoDEditor.LayerMaskField("Collision Flags", playerController.playerControllerData.terrainLayer); }
void RaycastVerticalGUISetup(TwoDTools.PlayerController2D playerController) { playerController.playerControllerData.verticalRaycasts = EditorGUILayout.IntField("Amount of Raycasts", playerController.playerControllerData.verticalRaycasts); playerController.playerControllerData.raycastSpreadAmountVertical = EditorGUILayout.FloatField("Spread Amount", playerController.playerControllerData.raycastSpreadAmountVertical); playerController.playerControllerData.raycastLengthVertical = EditorGUILayout.FloatField("Length", playerController.playerControllerData.raycastLengthVertical); playerController.playerControllerData.raycastVerticalIgnoreTriggers = EditorGUILayout.Toggle("Ignore Triggers Vertical", playerController.playerControllerData.raycastVerticalIgnoreTriggers); }
void PlayerMovementGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Player Movement", titles); EditorGUI.BeginDisabledGroup(true); // We only want the current velocity as a readonly but still accessible by other classes/components for writing to playerController.currentVelocity = EditorGUILayout.Vector2Field("Current Speed", playerController.currentVelocity); playerController.normalisedVelocity = EditorGUILayout.Vector2Field("Normalised Speed", playerController.normalisedVelocity); EditorGUI.EndDisabledGroup(); playerController.playerControllerData.maximumHorizontalVelocity = EditorGUILayout.FloatField("Maximum Speed", playerController.playerControllerData.maximumHorizontalVelocity); AccelerationGUIDisplay(playerController); SlopeMovementSettingsGUI(playerController); }
void PlayerWallJumpGUI(TwoDTools.PlayerController2D playerController) { GUILayout.Label("Player Wall Jump", titles); playerController.playerControllerData.useWallJump = EditorGUILayout.Toggle("Use Wall Jump", playerController.playerControllerData.useWallJump); switch (playerController.playerControllerData.useWallJump) { case false: break; case true: playerController.playerControllerData.horizontalForceJumpingAwayFromWall = EditorGUILayout.FloatField("Wall Jump Away From Wall Force", playerController.playerControllerData.horizontalForceJumpingAwayFromWall); playerController.playerControllerData.horizontalForceJumpingBackIntoWall = EditorGUILayout.FloatField("Wall Jump Into Same Wall Force", playerController.playerControllerData.horizontalForceJumpingBackIntoWall); break; } }